问:
Spherical (Ball) Joint in Robot Model not Working in Gazebo
I'm having trouble including a spherical/ball joint in my robot model. I have tried using the 'ball' joint type defined by sdf (http://sdformat.org/spec?ver=1.6&elem=joint#joint_type) but the urdf will no longer compile, throwing the error: 'Joint [joint_name] has no known type [ball]'.

I have also tried building a spherical joint using three orthogonal universal joints. The model does not throw any errors, and in rviz everything is displayed as expected and without issue. In gazebo however, neither the three universal joints composing the spherical joint nor the child link show up, or are listed as part of the model.

.xacro:

```<code>...
    <link name="${leg_name}_psi_link">
        <visual><geometry><sphere radius=".00001"/></geometry></visual>
        <collision><geometry><sphere radius=".00001"/></geometry></collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <mass value=".00001"/>
        <inertia ixx="0.00001" ixy="0.0" ixz="0.0" iyy="0.00001" iyz="0.0" izz="0.00001" />
    </link>

    <link name="${leg_name}_theta_link">
        <visual><geometry><sphere radius=".00001"/></geometry></visual>
        <collision><geometry><sphere radius=".00001"/></geometry></collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <mass value=".00001"/>
        <inertia ixx="0.00001" ixy="0.0" ixz="0.0" iyy="0.00001" iyz="0.0" izz="0.00001" />
    </link>

    <link name="<span class="math-container">${leg_name}_foot_link">
    <visual><geometry><mesh filename="$</span>{meshes_path}/foot_link.stl" /></geometry></visual>
        <collision><geometry><mesh filename="<span class="math-container">${meshes_path}/foot_link_collision.stl" /></geometry></collision>
    <xacro:default_inertial mass="$</span>{foot_mass}"/>
    </link>

    <joint name="<span class="math-container">${leg_name}_psi_joint" type="continuous" >
    <parent link="$</span>{leg_name}_tibia_link" />
        <child link="<span class="math-container">${leg_name}_psi_link" />
    <axis xyz="0 0 1" />
    <dynamics damping="0.005" />
    <origin xyz="0.075 0 0" rpy="0 0 0" />
    <limit lower="$</span>{-pi/2}" upper="<span class="math-container">${-pi/2}" velocity="$</span>{joint_velocity_limit}" effort="${joint_effort_limit}" />
    </joint>

    <joint name="<span class="math-container">${leg_name}_theta_joint" type="continuous" >
    <parent link="$</span>{leg_name}_psi_link"/>
        <child link="<span class="math-container">${leg_name}_theta_link"/>
    <axis xyz="0 1 0" />
    <dynamics damping="0.005" />
    <origin xyz="0 0 0" rpy="0 0 0" />
    <limit lower="$</span>{-pi/2}" upper="<span class="math-container">${-pi/2}" velocity="$</span>{joint_velocity_limit}" effort="${joint_effort_limit}" />
    </joint>

    <joint name="<span class="math-container">${leg_name}_phi_joint" type="continuous" >
    <parent link="$</span>{leg_name}_theta_link"/>
        <child link="<span class="math-container">${leg_name}_foot_link"/>
    <axis xyz="1 0 0" />
    <dynamics damping="0.005" />
    <origin xyz="0 0 0" rpy="0 0 0" />
    <limit lower="$</span>{-pi/2}" upper="<span class="math-container">${-pi/2}" velocity="$</span>{joint_velocity_limit}" effort="${joint_effort_limit}" />
    </joint>
...
</code>```

launch file (relevent parts)

```<code>  <!-- Load robot description -->
  <param name="robot_description" command="xacro --inorder 'path/to/robot.xacro'" />

  <!-- load the controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
        output="screen" ns="/syropod" args="joint_state_controller
              AL_coxa_joint
              AL_femur_joint
              AL_tibia_joint
              AR_coxa_joint
              AR_femur_joint
              AR_tibia_joint
              BL_coxa_joint
              BL_femur_joint
              BL_tibia_joint
              BR_coxa_joint
              BR_femur_joint
              BR_tibia_joint"/>

  <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
        args="-urdf
        -model syropod
        -param robot_description
        -x 0.0
        -y 0.0
        -z 0.2
        -R 0.0
        -P 0.0
        -Y 0.0
        -J AL_coxa_joint 0.0
        -J AL_femur_joint 0.0
        -J AL_tibia_joint 0.0
        -J AL_psi_joint 0.0
        -J AL_theta_joint 0.0
        -J AL_phi_joint 0.0
        -J AR_coxa_joint 0.0
        -J AR_femur_joint 0.0
        -J AR_tibia_joint 0.0
        -J AR_psi_joint 0.0
        -J AR_theta_joint 0.0
        -J AR_phi_joint 0.0
        -J BL_coxa_joint 0.0
        -J BL_femur_joint 0.0
        -J BL_tibia_joint 0.0
        -J BL_psi_joint 0.0
        -J BL_theta_joint 0.0
        -J BL_phi_joint 0.0
        -J BR_coxa_joint 0.0
        -J BR_femur_joint 0.0
        -J BR_tibia_joint 0.0
        -J BR_psi_joint 0.0
        -J BR_theta_joint 0.0
        -J BR_phi_joint 0.0"
  respawn="false" output="screen"/>
</code>```

***Why do none of the joints or links appear in the robot model?****What am I missing/doing wrong? Is there a better way to do this?*

Notes

the three orthogonal joints represent the roll pitch yaw of the spherical joint they compose. their mass and inertia matrices are close to zero intentionally. they are not zero because I understand that this can cause issues in gazebo.

${leg_name}_foot_link is the end effector link

Thanks

答:
Answer:

The issue is that <origin>, <mass>, and <inertia> tags must be nested inside a <inertial> element for each of the links, instead of being nested in the <link> tag.

correct:

```<code>     <link name="<span class="math-container">${leg_name}_psi_link">
         <visual><geometry><sphere radius=".01"/></geometry></visual>
         <collision><geometry><sphere radius=".005"/></geometry></collision>
         <inertial>
             <origin xyz="0 0 0" rpy="0 0 0"/>
             <mass value="$</span>{gimbal_link_mass}"/>
             <inertia ixx="0.1" ixy="0.0" ixz="0.0" iyy="0.1"  iyz="0.0" izz="0.1"/>
         </inertial>
     </link>
</code>```

incorrect:

```<code>     <link name="<span class="math-container">${leg_name}_psi_link">
     <visual><geometry><sphere radius=".01"/></geometry></visual>
     <collision><geometry><sphere radius=".005"/></geometry></collision>
     <origin xyz="0 0 0" rpy="0 0 0"/>
     <mass value="$</span>{gimbal_link_mass}"/>
         <inertia ixx="0.1" ixy="0.0" ixz="0.0" iyy="0.1" iyz="0.0" izz="0.1"/>
     </link>
</code>```

additional notes:

un-actuated joints should not have a <transmission> tag

gazebo will not load links with zero mass

Body:
Answer:

The issue is that <origin>, <mass>, and <inertia> tags must be nested inside a <inertial> element for each of the links, instead of being nested in the <link> tag.

correct:

     <link name="${leg_name}_psi_link">
         <visual><geometry><sphere radius=".01"/></geometry></visual>
         <collision><geometry><sphere radius=".005"/></geometry></collision>
         <inertial>
             <origin xyz="0 0 0" rpy="0 0 0"/>
             <mass value="${gimbal_link_mass}"/>
             <inertia ixx="0.1" ixy="0.0" ixz="0.0" iyy="0.1"  iyz="0.0" izz="0.1"/>
         </inertial>
     </link>

incorrect:

     <link name="${leg_name}_psi_link">
     <visual><geometry><sphere radius=".01"/></geometry></visual>
     <collision><geometry><sphere radius=".005"/></geometry></collision>
     <origin xyz="0 0 0" rpy="0 0 0"/>
     <mass value="${gimbal_link_mass}"/>
         <inertia ixx="0.1" ixy="0.0" ixz="0.0" iyy="0.1" iyz="0.0" izz="0.1"/>
     </link>

additional notes:

un-actuated joints should not have a <transmission> tag

gazebo will not load links with zero mass


问:
How to setup CLion for ROS?
How can I setup the C++ IDE CLion to display documentation and auto completion correctly when working with ROS?</p>

答:
Setup CLion with ROS

is a nice description on ROS Answers.

https://answers.ros.org/question/284786/setup-clion-with-ros/

ContentLicense: CC BY-SA 3.0

Title: How to setup CLion for ROS?

ContentLicense: CC BY-SA 4.0


问:
Noisy magnetometer data
I’m looking to develop an AHRS for which I’m using a magnetometer to correct for heading errors. I wanted to check that the magnetometer I'm using is functioning to the level of accuracy (+- 1 degree) that I’m aiming for, before doing any other development. However, the heading output from the magnetometer appears noisy when I test it.

To test the heading output from the magnetometer I’ve placed the magnetometer on the floor of a what I believe is a magnetically free environment. I’ve then collected magnetometer data for about 5mins - I’m using a pololu development board with a LIS3MDL magnetometer connected to an Arduino UNO. I’ve then used the atan2 function in Matlab to calculate the heading (multiplying by 180/pi to output the answer in degrees). When I look at the heading output the max and min of the data show a range of over 3 degrees. I’ve not calibrated the magnetometer, but my understanding is that calibration would only provide a bias and scaling, therefore any calibrated result would still be subject to the same noise. The magnetometer is not being moved during the test so I assumed that irrespective of the pitch, roll and heading of the device if the magnetometer is physically capable of giving me 1 degree heading it should output a relatively constant heading value over the test.

My questions are:
- does this seem a reasonable way of testing the heading accuracy?
- can I filter the magnetometer data to reduce the noise? If so what filter (I was thinking of a moving average filter) should I use and what constraints/limitations are there on how it’s used?
- Should a good magnetometer be less noisy than this and therefore not require any filtering?

答:
First, let's look at if your findings seem reasonable given the datasheet specifications for the sensor.

For this, I'll assume that Wikipedia is generally correct and that the strength of Earth's magnetic field is on the stronger end of the range given (0.25 to 0.60 gauss), so I'll use 0.6 gauss. Then I'll also assume that +Y is oriented to magnetic North and +X is oriented to magnetic East. Finally, I'll assume that your atan2 function is atan2(yAxis, xAxis), and that you're negating that output (to get positive angles in the clockwise direction) and offsetting by 90 degrees (to get zero at magnetic North).

So, what does the datasheet say? For "RMS noise," it's stating you should expect +/- 3.2 mgauss on the x- and y-axes. What does this work out to be? Well, assuming you have your sensor setup as described above, you would expect to have a y-axis reading of 0.6 gauss and an x-axis reading of 0.0 gauss.

Your noise could alter those readings, though! Worst case scenario here is reducing your y-axis reading from 0.6 gauss to (0.6 - 0.0032) = 0.5968 gauss, and a then having the x-axis "boosted" to +/- 3.2 mgauss, or 0.0032 gauss. This would then give a reading of:

```<code>minReading = -atan2(0.5968, -0.0032)*(180/pi) + 90; % Negate and offset to get to compass headings
maxReading = -atan2(0.5968, 0.0032)*(180/pi) + 90;
</code>```

This gives a min/max reading of -0.3 to 0.3 degrees. This doesn't confirm your findings! What's going on?

The issue is that RMS noise is the average noise. If you're considering worst-case, then you should consider the peak noise values you can expect to see. When you begin to talk about expected values you enter the land of statistics. Here is an application note from Analog Devices and here's another application note from Texas Instruments that both say the same thing (pages 5 and 4, respectively):

Multiply your RMS noise value by 6 to convert to peak-to-peak noise.

Be careful here, because now we go from a +/- RMS noise to a peak-to-peak noise. The peak-to-peak values already include the positive and negative range. You don't go +/- a peak-to-peak value because it already spans peak negative to peak positive. Now if you want to estimate the peak negative value you would use half of the peak-to-peak value.

So, what does this work out to be? First, convert from RMS to peak-to-peak:

```<code>noiseP2P = 6*noiseRMS;
</code>```

Then your max noise peak is (the positive) half and your min noise peak is (the negative) half of the peak-to-peak signal:

```<code>minNoise = -noiseP2P/2;
maxNoise = noiseP2P/2;
</code>```

And then finally re-calculate the minReading and maxReading values from before:

```<code>noiseRMS = 0.0032;
noiseP2P = noiseRMS*6.6;
minNoise = -noiseP2P/2;
maxNoise = noiseP2P/2;

minReading = -atan2(0.6 + minNoise, minNoise)*(180/pi) + 90;
maxReading = -atan2(0.6 + minNoise, maxNoise)*(180/pi) + 90;
</code>```

This gives a range of almost 2 degrees. If the Earth's magnetic field is weaker in your area than the upper limit given by Wikipedia then you'll get a different (larger) range. At the lower limit, 0.25 gauss, you get a range of 5 degrees!

So, given the numbers above, I would say that your observation of a 3 degree spread is normal and to be expected for the device you have.

You can use the same method to analyze other potential magnetometers and compare the expected performance of those versus your project's performance needs, etc.

Regarding techniques to mitigate, you can do anything from a simple lag filter (choose an alpha value like 0.05 and then do filterValue = alpha*newReading + (1-alpha)*filterValue) to a moving average like you mentioned, to a Kalman filter, to the Madgwick filter.

What you choose to implement filter-wise is dependent on your project needs, filter time constant/response, filter complexity, etc.

You may find that it is not possible to produce a filter that will simultaneously respond as quickly as you need while maintaining an acceptable noise floor. If this is the case then you need to evaluate other devices that feature a faster base response and/or a lower noise floor.

Title: Noisy magnetometer data

Body:
First, let's look at if your findings seem reasonable given the datasheet specifications for the sensor.

For this, I'll assume that Wikipedia is generally correct and that the strength of Earth's magnetic field is on the stronger end of the range given (0.25 to 0.60 gauss), so I'll use 0.6 gauss. Then I'll also assume that +Y is oriented to magnetic North and +X is oriented to magnetic East. Finally, I'll assume that your atan2 function is atan2(yAxis, xAxis), and that you're negating that output (to get positive angles in the clockwise direction) and offsetting by 90 degrees (to get zero at magnetic North).

So, what does the datasheet say? For "RMS noise," it's stating you should expect +/- 3.2 mgauss on the x- and y-axes. What does this work out to be? Well, assuming you have your sensor setup as described above, you would expect to have a y-axis reading of 0.6 gauss and an x-axis reading of 0.0 gauss.

Your noise could alter those readings, though! Worst case scenario here is reducing your y-axis reading from 0.6 gauss to (0.6 - 0.0032) = 0.5968 gauss, and a then having the x-axis "boosted" to +/- 3.2 mgauss, or 0.0032 gauss. This would then give a reading of:

minReading = -atan2(0.5968, -0.0032)*(180/pi) + 90; % Negate and offset to get to compass headings
maxReading = -atan2(0.5968, 0.0032)*(180/pi) + 90;

This gives a min/max reading of -0.3 to 0.3 degrees. This doesn't confirm your findings! What's going on?

The issue is that RMS noise is the average noise. If you're considering worst-case, then you should consider the peak noise values you can expect to see. When you begin to talk about expected values you enter the land of statistics. Here is an application note from Analog Devices and here's another application note from Texas Instruments that both say the same thing (pages 5 and 4, respectively):

Multiply your RMS noise value by 6 to convert to peak-to-peak noise.

Be careful here, because now we go from a +/- RMS noise to a peak-to-peak noise. The peak-to-peak values already include the positive and negative range. You don't go +/- a peak-to-peak value because it already spans peak negative to peak positive. Now if you want to estimate the peak negative value you would use half of the peak-to-peak value.

So, what does this work out to be? First, convert from RMS to peak-to-peak:

noiseP2P = 6*noiseRMS;

Then your max noise peak is (the positive) half and your min noise peak is (the negative) half of the peak-to-peak signal:

minNoise = -noiseP2P/2;
maxNoise = noiseP2P/2;

And then finally re-calculate the minReading and maxReading values from before:

noiseRMS = 0.0032;
noiseP2P = noiseRMS*6.6;
minNoise = -noiseP2P/2;
maxNoise = noiseP2P/2;

minReading = -atan2(0.6 + minNoise, minNoise)*(180/pi) + 90;
maxReading = -atan2(0.6 + minNoise, maxNoise)*(180/pi) + 90;

This gives a range of almost 2 degrees. If the Earth's magnetic field is weaker in your area than the upper limit given by Wikipedia then you'll get a different (larger) range. At the lower limit, 0.25 gauss, you get a range of 5 degrees!

So, given the numbers above, I would say that your observation of a 3 degree spread is normal and to be expected for the device you have.

You can use the same method to analyze other potential magnetometers and compare the expected performance of those versus your project's performance needs, etc.

Regarding techniques to mitigate, you can do anything from a simple lag filter (choose an alpha value like 0.05 and then do filterValue = alpha*newReading + (1-alpha)*filterValue) to a moving average like you mentioned, to a Kalman filter, to the Madgwick filter.

What you choose to implement filter-wise is dependent on your project needs, filter time constant/response, filter complexity, etc.

You may find that it is not possible to produce a filter that will simultaneously respond as quickly as you need while maintaining an acceptable noise floor. If this is the case then you need to evaluate other devices that feature a faster base response and/or a lower noise floor.


问:
How to derive the Jacobian for a floating base linkage?
I am trying to determine the Jacobian for a planar bipedal robot. I'm modeling it as a floating base system with 5 links (floating base and 2 two-link legs), which seems to be the common approach. I know that the dimension of the Jacobian must be 5 by 3 since I have 5 links and 3 degrees of freedom in the plane. However, I'm not sure how to proceed because I've only dealt with linkages that are always connected to the base. Any help would be appreciated. Thank you.</p>

答:
Actually since a Jacobian maps joint velocities to workspace velocities (linear and angular) of a point of interest (for example, the robot's center of gravity), in this case, your Jacobian will have the dimension of $3 \times 4$, where 3 is the number of your workspace degrees-of-freedom (2 translation axes + 1 rotation axis) and 4 is the number of joints.

I think first you may want to ask yourself what your point of interest is. Is it the center of the body (base link)? Is it the center of gravity of the whole robot? Then you can start your derivation of a Jacobian equation from there.


问:
Moldable rubber for "feet"
I’m trying to inject some kind of rubber around an aluminum strut to form “feet” for a robot. I’ve already milled the mold, but I’m having trouble finding an inexpensive and readily available rubber compound that will cure without exposure to air. Ideally it should cure to about the consistency of a silicone O-ring. I’ve tried silicone gasket-maker (the automotive stuff), however a week later it hasn’t cured in the mold, as there is no exposure to the air.  Is there anything out there with a similar consistency to silicone, but doesn’t require air to cure?  Or is there a way to get what I’m currently using to set up without waiting a millennium?  There aren’t any real mechanical requirements, I’m just trying to clean up the look of the robot and prevent its legs from scratching my table. </p>

答:
You need a two-part resin of some sort.  Search on "room-temperature vulcanized" rubber, or "RTV rubber".  There may also be epoxies that are designed to dry rubbery.

You want stuff that comes with an activator -- if it's single-part RTV it depends on drying or on oxygen in the air to kick off, and you're back to never curing.

Your challenge will be to find something that is available in small quantities to the hobbyist.  I can't help you with that, alas -- I just have the name floating around in my head from some prior research, and new what search terms to type in.

Here's an example, but I couldn't even say if they'd sell to you: http://www.contenti.com/products/casting/179-050.html.

Title: Moldable rubber for "feet"


问:
What is the rectangular-shaped joint in this diagram?
What is the rectangular-shaped joint under the M1? What does it do, and what is its DOF?

答:
That diagram appears to be taken from the paper Design and development of a Mechanism of Robotic Arm for Lifting (Part 5), by M.H.Ismail et al - which is available to download as a pdf file from ResearchGate.

That paper also includes the following free-body diagram of the arm:

It is, perhaps, easier to see from this diagram that the 'rectangular-shaped' joint under M1 in your diagram:

is simply a revolute joint, constrained to rotate in a single plane, allowing the arm to be rotated on the base.

The depiction is different to the other revolute joints because it shows a side-view of the joint, rather than an end-view as we have in the other three revolute joints.


问:
smoothing the robot poses inbetween two known poses
I have a set of N robot poses between point A and B. I use a global localization technique to estimate poses at point A and B. As a result, I have a new corrected pose B'. Please see the figure below.

Considering the poses A and B' are now fixed, how do I smooth out the in-between poses such that there is a smooth transition between A and B'? I know the relative poses between each node in the white trajectory. Please help me formulate this problem. Is this a graph optimization problem? or is there any other simple approach for smoothing out the jump?

答:
You could try to use a bezier curve (https://en.wikipedia.org/wiki/B%C3%A9zier_curve) to interpolate with a curve and via points between A and B'. Also, is this a mobile robot or a robot arm? </p>

<p>Do you need to go through all the points ? </p>

Body:
You could try to use a bezier curve (https://en.wikipedia.org/wiki/B%C3%A9zier_curve) to interpolate with a curve and via points between A and B'. Also, is this a mobile robot or a robot arm?

Do you need to go through all the points ?


问:
Building a non rotating persistence of vision device
I'm looking for a way to create a non-rotating persistence of vision device. I have all the electronics set up but I'm stumped with the mechanical design.
I tried these two designs:

But these didn't work so well. Everything shakes violently and it doesn't go nearly as fast as I need (about 20 swipes per second)
Any ideas on how I can build this?

答:
I'm looking for a way to create a non-rotating persistence of vision device.

It seems to me that the two designs that you propose yourself, at least rely on rotation.

I would suggest getting rid of rotation entirely. In particular since you say you have problems swinging these arms around.

One way to go about this, is by using magnets, springs and electro magnets. Actually, instead of me explaining this, go look at a loud speaker unit, and apply that same principle to your challenge. You want it to move further though, so use some soft springs to suspend your moving  component between, so you can get some good range on it.

```<code>          <fixed electro magnet>               L
<spring>--<free moving magnet>--<electronics>--E--<spring>
          <fixed electro magnet>               D
</code>```

The middle line can move from side to side, the electromagnet is curled around the sliding assembly

You would likely need to drive the electro magnet in both directions (reversing the poles) to get some good speed too.

The benefit of this, is that the suspended electronics, can be really light, so you dont need some really heavy weights to keep the vibrations down. And the two springs of either end, could carry the power to the moving electronics.

EDIT:
I got inspired by rocketnagnet's graphics, so i stole some of it, to clarify just a little bit, just to give a hint as to how my ascii graphics was intended.

Body:
I'm looking for a way to create a non-rotating persistence of vision device.

It seems to me that the two designs that you propose yourself, at least rely on rotation.

I would suggest getting rid of rotation entirely. In particular since you say you have problems swinging these arms around.

One way to go about this, is by using magnets, springs and electro magnets. Actually, instead of me explaining this, go look at a loud speaker unit, and apply that same principle to your challenge. You want it to move further though, so use some soft springs to suspend your moving  component between, so you can get some good range on it.

          <fixed electro magnet>               L
<spring>--<free moving magnet>--<electronics>--E--<spring>
          <fixed electro magnet>               D

The middle line can move from side to side, the electromagnet is curled around the sliding assembly

You would likely need to drive the electro magnet in both directions (reversing the poles) to get some good speed too.

The benefit of this, is that the suspended electronics, can be really light, so you dont need some really heavy weights to keep the vibrations down. And the two springs of either end, could carry the power to the moving electronics.

EDIT:
I got inspired by rocketnagnet's graphics, so i stole some of it, to clarify just a little bit, just to give a hint as to how my ascii graphics was intended.


答:
To get a smooth trajectory you should not have jumps in acceleration and because you are talking about pose both rotational and translational accelerations should be smooth. You can achieve this with interpolation.
If you know the initial position & velocity and also final position & velocity, you have four boundary conditions and there for you can create a polynomial of degree 3 to represent the path between the two points.

$$q(t) = a_0 + a_1 t + a_2 t^2 + a_3 t^3 $$

where you can define the four parameters from the boundary conditions that you have.

$$q(t_0) = a_0 + a_1 t_0 + a_2 t_0^2 + a_3 t_0^3 = q_0  $$

$$ \dot q(t_0) = a_1 + a_2 t_0 + a_3 t_0^2 = \dot q_0 $$

$$ q(t_f) = a_0 + a_1 t_f + a_2 t_f^2 + a_3 t_f^3 = q_f$$

$$\dot q(t_f) = a_1 + a_2 t_f + a_3 t_f^2 = \dot q_f$$

By solvinfg this problem you will get a smooth trajectory.

http://www-lar.deis.unibo.it/people/cmelchiorri/Files_Robotica/FIR_07_Traj_1.pdf

Title: smoothing the robot poses inbetween two known poses

Body:
I have a set of N robot poses between point A and B. I use a global localization technique to estimate poses at point A and B. As a result, I have a new corrected pose B'. Please see the figure below.

Considering the poses A and B' are now fixed, how do I smooth out the in-between poses such that there is a smooth transition between A and B'? I know the relative poses between each node in the white trajectory. Please help me formulate this problem. Is this a graph optimization problem? or is there any other simple approach for smoothing out the jump?


答:
You are right. That is absolutly graph optimization problem. Sorry for the answers above but you don't need spline or acceleration for this.

The graph optimization will find 5 poses above in your figure that reduce your sensor observation error at B as well as all the other inter poses. Graph optimization usually includes constraints on relative poses. That does exactly do the job you want.


问:
How to add a magnetometer in an Extended Kalman filter for innovation update?
I can't find out the response so I am posting here.

My post kind of follow this one : Adding magnetic field vector to a Kalman filter
but I already know that I don't have to put the magnetometer in a state vector.

I am working on a implementation of an Extended Kalman filter. So far I have integrated a gyroscope, an accelerometer and encoders wheels.

But I don't know what are the equation for the update state to integrate a magnetometer.

So far :

I have seen some kind of work where magnetometer are fuse with accelerometer.
But I don't have any formulas and I am kind of stuck...

I have seen some kind of work where there is no quaternion but I can't afford this modelisation cause of gimbal lock and I have all my work already in quaternion...

Thanks in advance for help. Don't hesitate if you need complementary details.

答: A magnetometer measures the local magnetic field. When assuming that the Earth is the only magnetic source, then this magnetic field should be constant in world coordinates. But the magnetometer measures the magnetic field in local body fixed coordinates. The world and body coordinates should be related via the unit quaternion. So the magnetometer measures a constant vector rotated by the quaternion. In order to find this constant vector you would need to do some calibration at the start of each flight.</p>


问:
Quadcopter mathematical model and controller design

if we just examine the translational dynamics (X and Y direction), the dynamics are coupled, So if I want to design a PID controller to control the position, the outcome will be unpredictable because of the coupling.I some research papers , I have seen people assume  (psi =0 ) at the equilibrium point  to remove the coupling in x and y dynamics. But I would like to design a controller along with the couple system? Is there any solution like decoupling the dynamics equations or something.

答:
You can linearize and decouple the system about equilibrium under the following assumptions:

Small angle approximation: $\sin(x) \approx x$ and $\cos(x) \approx 1$

Angular acceleration due to actuators only: $\dot{p} = \frac{U_2}{I_{xx}}$,  $\dot{r} = \frac{U_3}{I_{yy}}$, $\dot{p} = \frac{U_4}{I_{zz}}$


问:
How to calculate shortest path between multiple pick and drop destinations
I have a scenario where I have multiple robots, and they have to pick and drop some items at specified locations as shown in Figure.

There are 4 jobs to be done for this particular instance. How can I go about planning the shortest optimized path for carrying out these jobs.

I am a beginner in path planning and am finding it difficult to come up with a solution that can work in this case. I can use dikstra and A* etc to find all possible paths but in my case I have a constraint that the destination node cant be reached if the source node for that particular destination node hasnt been visited first.

答:
Side note:  If there are multiple objects at A and C, so the robots continue circulating to move the objects cyclically, then ABCD and CDAB are the same paths.   In either case (single objects at A and C or multiple objects), just assign a weight to each segment that equals the distance travelled to go from source to destination.  Add the segment lengths and choose the minimum.  With this few number of nodes, an exhaustive search method like this would work.

As a thought exercise, and to confirm this method, assume the distance between A and B is very short, but that D is far away from A.   I’ll choose 1 for segment AB and 10 for segment AD.   In this case, let’s say that BD is 10.5 so the geometry makes sense.   Let’s just compare those paths that begin with travelling along CA (but you’ll have to do this for all paths).  Your choices are CABD and CADB.

For these two paths, CA is the same so we can disregard it for this exercise.   So you are left with ABD vs ADB.  ABD lengths are 1 + 10.5 = 11.5.   ADB lengths are 10 + 10.5 = 20.5.   So in this arrangement, CABD would be more optimal.

In addition to the distances between nodes, you may have to consider additional weights that stand for the distances between robots 1 and 2 and the various starting node options.

As the number of nodes increases, more advanced methods and heuristics would be needed rather than an exhaustive search.


问:
Is a printer a robot?
While formulating an answer to this question let us consider the parts and the function of the printer during its basic process. We tell the printer what we want it to do, "print this". The printer then produces the product we told it to produce. The printer is complex, being composed of multiple motors, and lever mechanisms which one might find in a robot. Printers, especially all-in-one printers are capable of multiple tasks. Printers such as these also have a sensor which "sees" an object and can replicate the object. There may now exist combinations of sensors which "see" and possibly "feel" an object which can be replicated in 3D. These are tasks which historically were performed by humans.

The answer should be more than yes or no, including explanation or proof.

Edit:

In response to posts regarding this question being a duplicate of What is the difference between a Robot and a Machine?, it is not. I am asking the reader if this particular device known as a printer is considered a type of robot. However, the suggested duplicate does offer more information to help answer this question. Also, it is suggested in the proposed duplicate post that THAT post should be placed in the philosophy exchange. I see the logic in my post and the other being placed there. I do also think these questions should be posted here because they are specific to robotics.

As for clarification, I am leaning toward personally defining printers, especially newer models, all-in-ones, and various 3d printing devices as robots. I am asking in order to clarify my own understanding and see if others agree. I also am seeking to understand the technology better and am having a hard time finding resources to study. I asked a question about the sort of courses I might take at school in the Academia exchange and no one knew ( https://academia.stackexchange.com/questions/120366/what-courses-would-teach-me-how-to-better-understand-computer-printers ) So, I came here thinking I might need to take robotics courses to really learn how to make a printer for the future.

Edit:

FooBar has the best answer so far in the comments:

"Most printers have a very limited set of sensors (some limit switches and temperature sensors), but most are not even able to detect failed prints. So they are not able to sense or react to their environment."

Furthermore, thank you all for your comments/answers. I have found what I was looking for here.

答:
3d printers are without any doubt robots. The open question is, why don't they are behave so in reality? RepRap like printers for rapid prototyping are available since the year 2005. And additional robot arms who can take the object out of the shelf are also available as lowcost kit. The main problem isn't the hardware itself but the software. This piece of technology is called the printer driver which runs on the lowlevel side of the machine and on top of the firmware is the printing driver which has to control the device but also the robot arm in front of it. Providing the action commands for such a rapid prototyping assembly line is not an easy task. Each cnc-motor has a position and a torque and it's complicated to coordinate them all, especially in autonomous mode.

If seems that the bottleneck of printers isn't the hardware itself, which runs stable since decades, but the reason why printers are not recognized as human like robots has to do with the missing Artificial Intelligence software. That means, if someone is able to program the ROS software package for controlling a reprap 3d printer, he will transform the piece of plastic into a living organism which can reproduce itself. So the problem isn't the device but the firmware. That is an algorithm, which puts control commands into the machine.

Title: Is a printer a robot?


问:
Transformation matrix between a 2D and a 3D coordinate system
I have 2 sensors : one has 2D coordinate system and the other has a 3D coordinate system (not same origin).

Knowing the positions of some corresponding target points (used as fixed reference) in both coordinate systems,

How can I get the transformation matrix T (Rotation, translation and scaling) that would map the 3D point P3D to a 2D point P2D?
 So that : P2D = T * P3D.

答:
You need two things.

A transformation from 3D device coordinate to 2d device coordinate.
$$p_{C}=T*p_{L}$$

Projective matrix

$$u_{C}=P*p_{C}$$
u is 2D location and p is 3D location.

To find 1 you need to do a 3D device to 2d device calibration. The method depends on your sensor configuration. Projective matrix can be found from your camera model.


问:
How do I compute the translation and rotation velocities of a robot
I am stuck at computing the translation and rotation of a robot moving onto an ellipse given by:

$$
p(t) =(m) + \cos(t)∗a + \sin(t)*b
$$

where m = center of ellipse and the two axes a (horizontal) and b (vertical).

At the moment I am using derivation $p'(t)$ for calculating the translation, like

$$
p'(t)_x = -\sin(t)*a \\
p'(t)_y = \cos(t)*b
$$

$$
p'(t) = \sqrt{p'(t)_x^2 + p'(t)_y^2}
$$

and rotation velocity, with

$$
p''(t)_x = -\cos(t)*a \\
p''(t)_y = -\sin(t)*b
$$

$$
p''(t) = \frac{p'(t)_x p''(t)_y - p''(t)_x p'(t)_y}{ (p'(t)_x)^2 + (p'(t)_y)^2} $$

(see formula)

However, the robot is just moving in strange curls instead of an ellipse.
If anyone needs the full code just say so.

$$
\omega = \dot{\phi} = \frac{\dot{d_x}\ddot{d_y} - \ddot{d_x}\dot{d_y}}{\dot{d_x}^2+\dot{d_y}^2}
$$

答:
As Chuck said you are using the parametric form of the ellipse

$p(t) = (m) + cos(t)*a + sin(t)*b$  the $t$ doesn't represent the time but the eccentric anomaly. But from this equation you can create a matrix for $t\epsilon [0,2\pi]$ and calculate the points on the eclipse from the equations

$ x = a*cos(t) $ , $ y = b*sin(t) $ then you have $(x,y)$ points and by setting a specific time that you want to go from one point to another you can find the velocities ${\Delta x\over \Delta t} , {\Delta x\over \Delta t} $. Not the best way to do it, but it is something.


答:
Instead of trying to mold a liquid, you could try to form a viscoelastic solid.  That way, the uncured material would keep its shape without an airtight mold.  </p>

<p>There's a product called Sugru that you might try; it's hand-moldable silicone rubber that dries in air.  (I am not affiliated with their company.)  </p>

Title: Moldable rubber for "feet"

Body: I’m trying to inject some kind of rubber around an aluminum strut to form “feet” for a robot. I’ve already milled the mold, but I’m having trouble finding an inexpensive and readily available rubber compound that will cure without exposure to air. Ideally it should cure to about the consistency of a silicone O-ring. I’ve tried silicone gasket-maker (the automotive stuff), however a week later it hasn’t cured in the mold, as there is no exposure to the air.  Is there anything out there with a similar consistency to silicone, but doesn’t require air to cure?  Or is there a way to get what I’m currently using to set up without waiting a millennium?  There aren’t any real mechanical requirements, I’m just trying to clean up the look of the robot and prevent its legs from scratching my table. </p>

Body:
Instead of trying to mold a liquid, you could try to form a viscoelastic solid.  That way, the uncured material would keep its shape without an airtight mold.

There's a product called Sugru that you might try; it's hand-moldable silicone rubber that dries in air.  (I am not affiliated with their company.)


答: One approach would be to use A* to plan a path to the pickup point and then again to plan a path to the dropout off point all the while ignoring that there are other moving agents. That should be pretty straightforward. From there you need to concern yourself with collision avoidance. For that you could look at Generalized Reciprocal Collision Avoidance (GRCA). If I recall correctly you should be able to use the A* solution to jump start the GRCA calculations by using it as a nominal trajectory.</p>

Title: How to calculate shortest path between multiple pick and drop destinations

Body:
I have a scenario where I have multiple robots, and they have to pick and drop some items at specified locations as shown in Figure.

There are 4 jobs to be done for this particular instance. How can I go about planning the shortest optimized path for carrying out these jobs.

I am a beginner in path planning and am finding it difficult to come up with a solution that can work in this case. I can use dikstra and A* etc to find all possible paths but in my case I have a constraint that the destination node cant be reached if the source node for that particular destination node hasnt been visited first.


问:
What is the front mechanism of this robot's track called?
What is the mechanism on the front of the tracks of this robot called?  They are also tracks, but they are able to be moved by the operator, and they are able to function as tracks.  I've only seen them on iRobot's military robots, and a handful of DIY projects over the years.  Does that mean it's patented?

Here are a few pictures from an internet search that show the front flipper track (for lack of a better term):

答:
They seem to be called 'flippers' in most of the literature.

This review of the iRobot 310 SUGV on Army Technology notes that:

The 310 SUGV has an overall length of 76.1cm and width (flippers on) of 43.7cm. The length with flippers stowed is 70.8cm.

Similarly, this 2010 research paper titled Automatic fine motor control behaviours for autonomous mobile agents operating on uneven terrains also describes the attachments as 'flippers':


问:
Mujoco and MoveIt!
I want to implement deep reinforcement learning using a UR5 robot. A little research told me nowadays researchers are using openAI gym, Mujoco, rllab as their frameworks. The thing is, I want to train my UR5 robot in virtual environment and transfer the learning to my real robot. The task can be peg insertion.

Previously I worked on a project using ROS with the UR5 robot and a Kinect. In that project, we are using MoveIt for motion planning. Everything has already been set up and I'm quite familiar with ROS and MoveIt.

Do you think I should bother myself modeling the UR5 robot and adding RGBD camera using Mujoco (I am not sure if I can do this in Mujoco), and after that training it using openAI gym framework, and finally transferring learning to the real robot using ROS? Or should I stick with ROS and MoveIt while incorporating openAI gym only as my reinforcement learning framework? I just don't see why I need Mujoco if I can use MoveIt and gazebo for modeling, which is already done. Thanks for your advice on this.

答:
You will need MuJoCo if you care about robust physics predictions.

For UR5 robot, we have created a model for MuJoCo here. This is, however, a planar robot. We have removed the joints from UR5 and we are using it as a planar robot for now. You can use it as a starting point, however.

Another solution is to use OpenRAVE simulator. We wrote a controller for UR5 specifically. It's available here. OpenRAVE will probably be the best option given the controller mentioned. If you want physics-predictions it gets a bit tricky, however. But using OpenRAVE and the UR5Controller provided you will be able to plan in simulation and then execute on the real robot.

Title: Mujoco and MoveIt!


问:
Is it possible to make Kite flying robot?
This question was asked in electronics stackexchange. I want to know if is it possible to make a robot that can fly kites. Is this idea practical? I was thinking that making a kite is just like making some flying quadcopter or helicopter. I just want to know is this idea really implementable?  Is there an example or similar work in reference to this?     </p>

答:
I am working on an open source project to make a platform to make diy automated kite steering unit. I sent a reply as well on electronics.stackexchange.com

I am using SimpleCV which is a python binding to OpenCV to get the position and orientation of the kite relative to the camera of my mobile phone. I use the acceleration and magnetometer of my mobile phone to get the orientation of the camera. I then send the data to my computer over wifi and process them into python.

The project is still in development, but everybody's welcome to help. The source code and documentation is available here http://code.google.com/p/robokite/ I have a blog but it is in french, soon in English?

You can also have a look at zenith wind power. It's a student project. The code was on google code as well, but can't be seen anymore for unknown reason. However, you can still get it with svn checkout http://zenith-wind-power.googlecode.com/svn/trunk I was not able to compile it, but they made a great job. Adrien should start working again on the project in September.

You have as well academics project (mainly TU Delft).
And you have the "proprietary" solution lie Makani power, sky sails, kite gen.

Hope it helps!
Baptiste LABAT


答:
On the first look, the question looks like an pathplanning problem in which the total amount of travel-distance has to be minimized. But a detailed look shows, that the problem is more complicated because many robots are in the game who have different tasks for start/destination points. The first step is to give such a challenge a name. I would call it a “blackboard scheduling problem”. A blackboard architecture isn't an algorithm but a datastructure for implementing a multi-agent system. Multi-agent doesn't mean, that many robots are available but many software-agents which are equal to planning submodules.

Let us go into the details. The output of the software is a plan which control the pick&place robots to drive around in the map. Before such a plan can be created many subplans are needed which are optimized for certain constraints, for example in respect to the local distance and if the pick&place action make sense in comparison to the job list in the table. Evaluating different kind of plans by separate planners can be realized on a blackboard. That means an example plan is stored in the datastructure and then the software agents are given feedback how well the plan looks to them. An overall control loop summarizes the comments of the agents and produces the resulting plan. This can be executed on the real robots.


问:
Iterative Closest Point for 2-D LIDAR Data
I have two 2-D point clouds obtained from LIDAR (Light Detection And Ranging) scans at two different poses (positions and orientations) inside a circular structure, where a small object (vertical cylindrical column) is placed at a fixed location. My objective here is to match as closely as possible the two point clouds and find the planar transformation (translation and rotation) to do that. One useful technique—I believe—would be the point set registration using the ICP (Iterative Closest Point) algorithm.

The issue now is that the algorithm fails to match perfectly the two point clouds, specifically in terms of rotation because it didn't complete matching the data points related to the object inside the circle. Therefore, my question is: would this be a limitation of the ICP algorithm, or a problem in implementing it (which I doubt it since I double-checked with Matlab ICP embedded function)?

Are there other methods/algorithms that can solve this problem?

答:
This is what worked for me (to auto-align sparse scans, which can also be useful in SLAM when it gets lost):

Run a corner detector for each scan (convert the LIDAR output into a single path and run a line simplification algorithm to extract the vertexes). As an improvement, you can also detect middle-of-the-air points  using a filter and create multiple paths containing only continuous points.

Since a single corner (POI) doesn't provide enough information for alignment, create features composed of pairs of POIs for each scan. Each feature has a >--< shape and contains the distance between the POIs, the adjacent walls' lenght and its relative angle to the line that connect the POIs. Sort them by length (between POIs).

Compare each feature in your current scan to all features in all other scans with about the same length (find the lower_bound and upper_bound to speed things up). Give them a cost, by similarity (between angles, walls length, compass,...), and add the matched feature lines to a vector;

Sort this vector and select the best candidates;

Create a low resolution probability map with the points from all other scans (initializing it with 0.5 and increasing the probability every time a point is "painted" in a given position)

For each candidate, calculate the transformation required to align the two matched lines and get the RMSD: sqrt(sum ((1-prob)^2)/n )

Sort by RMSD

Group the N best candidates to remove overlapping matches and remove bad candidates

As an optimization, here I create a custom map to each remaining candidate. Differently to the previous map, this one only contain points where the LIDAR position is on the same side of the wall of the scanned points. It avoids matching points that are on the other side of the walls

Sort again by RMSD and take the best(s) candidate(s)

Run a fine/local placement algorithm to calculate the final position. I use a multi-resolution probability map (created with the same technique as in item 9) and use an iterative and greedy gradient descend algorithm to snap the points to the nearest position with smaller RMSD.

Many of these steps may be optional and where implemented just to improve performance and reduce wrong matches.
Using optimization techniques, I could auto-align one scan to other 50 with a very high precision in around 0.4s in today's computers.


问:
Jacobian of a 6DOF arm
I have a robot with 6 DOF. I read a lot of tutorial on how to compute the Jacobian, but usually all examples are for planar robots with 2DOF.

I don't understand how can I get the Jacobian of a 6 DOF robot.

I know that Torque = J_transpose * Force.

I want to compute the force of my end effector when I apply some torque. For this reason I need the Jacobian.

Thank you very much

答:
Write the forward kinematic equations $$\vec(x) = F\vec(\theta)$$

Taking the partial derivatives of each $\vec (x)$ term with respect to each joint variable $\vec(\theta)$ will give you $J$.

Title: Jacobian of a 6DOF arm


问:
State Space Model of Brushless DC
I am working on a project in which I want to use State Feedback Control to position control a BLDC motor in combination with a motor controller. I want to do this since translating time domain specifications into controller gain using this method is way more exact than the heuristic method of PID tuning. I would run the current control PD on the microcontroller and the state feedback on a microcontroller. For this to work, a state space representation needs to be made of the whole BLDC system. Using the control scheme shown below, I wanted to determine the state space representation of the green box, where the current command is the input, as shown by the red arrow, and the motor position is the output. I have done much research and have found complicated versions which will require also modeling the inverter, or simple 2nd/3rd order systems.

My questions are:

What is the correct state space model to use?

Would you advise to take the other approach of applying system identification methods to determine the state space?

答:
There is probably no 100% correct/accurate (state space) model. You should consider what is your required precision and use the simplest model which fulfills your accuracy requirements. If you do not have a strict requirement start with the simplest one and if it is not sufficient, upgrade the model.

You can use system identification methods to find model parameters. If you want high accuracy for one specific motor, this would be a good way of improving model accuracy. It might also work well for one specific motor model, depending on manufactruing quality (or the consistency of the manufacturing quality). If you one to apply it to different motors you might need to redo the parameter identification process for each (or at least each motor model).

Title: State Space Model of Brushless DC


问:
Raspberry Pi Robot Car won't drive straight, right wheel is faster
My Raspberry Pi car bot will not drive straight at all.

After examining and listening to the two motors, I noticed that the right wheel is a lot faster. I have matching wheels and the same code structure for commanding my wheels to turn. I have my motors hooked to an H-bridge also.  I am not using PWM or anything fancy that I am aware of. I have watched many YouTube videos of programming robots to drive and my code is not that much different.

Why are my wheels turning at different speeds when programmed the same way? How should I fix this?

答: Did you implement a controler? It is common that the same model motors are not exactly the same and if you just give an input each one is going to behave differently. If you have feedback from the motors you can implement an PID controler and see the results. It's pretty easy to implement a couple of code lines.</p>


答:
By taking the time derivative of the forward kinematics equation, you get a Jacobian equation, as @steveo said in his answer. What is interesting is that by using some properties of rotation matrices, we can derive a rather impressive formula for computing a Jacobian.

In short, a Jacobian can be computed as

$$J = \begin{bmatrix}J_1 & J_2 & \cdots J_n\end{bmatrix},$$

where
change revolute to prismatic joint so that jacobian is correct that way
$$J_i = \begin{cases}
\begin{bmatrix}z_{i - 1}\\0_{3\times1}\end{bmatrix} & \text{the $i^\text{th}$ joint is prismatic}\\
\begin{bmatrix}z_{i - 1} \times (o_n - o_{i - 1})\\z_{i - 1}\end{bmatrix} & \text{the $i^\text{th}$ joint is revolute (linear)}
\end{cases},$$
$z_i$ is the axis of the $i^\text{th}$ joint and $o_i$ is the origin of the $i^\text{th}$ frame.

Note that a Jacobian matrix $J$ is actually a function of a joint value $q$. (We can also see this from the above equation as the joint position $o_i$ and the joint orientation $z_i$ change when the robot changes joint values.) For 6-DOF robots, although it is very unlikely that you will be able to obtain a closed form formula for $J(q)$, computing $J$ for a given $q$ is pretty straightforward.

For more details, see Chapter 3 of Robots Dynamics and Control (Spong et al.).

Title: Jacobian of a 6DOF arm

Body:
I have a robot with 6 DOF. I read a lot of tutorial on how to compute the Jacobian, but usually all examples are for planar robots with 2DOF.

I don't understand how can I get the Jacobian of a 6 DOF robot.

I know that Torque = J_transpose * Force.

I want to compute the force of my end effector when I apply some torque. For this reason I need the Jacobian.

Thank you very much


问:
smooth robot 3D trajectory using graph optimization
I want to solve a trajectory smoothing problem using graph optimization. I have asked questions on how to solve this problem in a previous post and got directed towards using graph optimization.

I have, say 5 poses between points A and B. Hence there are 5 graph nodes. I know the relative poses between each graph node as well. I got a new pose for the 5th node point B'. I want to elastically move the entire trajectory with points A and B' as fixed. Please see pic here. I am stuck on how to formulate the information matrix needed for each node pair. I have not taken a robotics course and hence finding it difficult to comprehend the documents about graph-slam. Please help me with the questions below

I am planning to use ceres c++ library for pose graph optimization (especially the pose_graph_3d executable). I was trying to formulate my problem into a pose graph.

I have set up the nodes in the following format VERTEX_SE3:QUAT ID x y z q_x q_y q_z q_w

I know the relative poses between the nodes. I want to setup the relative constraint between the nodes in the format

EDGE_SE3:QUAT ID_a ID_b x_ab y_ab z_ab q_x_ab q_y_ab q_z_ab q_w_ab I_11 I_12 I_13 ... I_16 I_22 I_23 ... I_26 ... I_66

I am able to setup the format upto the relative position and relative quaternions for a node pair. But how to calculate the information matrix? I do not have landmarks and is not a SLAM problem.

I understand that the information matrix is the inverse of covariance matrix. I want to provide an equal amount of uncertainty to each node relative poses and if am correct, the flexibility of my trajectory will depend on how big is this uncertainty. But what are the variables the covariance matrix describes? Is it the relative position x y z and relative orientation euler angles rx ry rz ?

My understanding is that I have to setup the information matrix myself empirically. If that is so, what value can I set it to?

Edit1: I set up all the information matrices to Identity I. I then took the vertices and constraints and formulated a graph-slam problem in .g2o format. I perturbed the last node alone from B to B'. I ran the graph optimization on it, but the optimized trajectory resembled AB. Please find the unperturbed and perturbed trajectory files in the link. The same thing happens even if I set the information matrix as a multiple of I matrix (to increase the uncertainty in 6D parameters) . I used pose_graph_3d executable of the ceres library. I expected the drift to be distributed across all the nodes. Why doesn't this happen?

答: If your problem is small and uncertainty information is not available, you can just set it with identity matrices. Covariance or information matrix will let you set which relative pose to trust more, but it is meaningless if such information is not available. </p>


问:
Does Create 2 have a built in optical interface (IR remote) using the Open Interface Spec
I was starting to work on the Arduino interface (and Raspberry Pi) using the USB serial cable for the Create 2 , as a baseline to build other outer loop controls.
My wife asked me why I would do that, and she handed me her Roomba remote control. It worked !
Well, the Roomba IR remote only transmits, and the functions are only a small subset of the Open Interface Spec.
Rather than jumping into another Arduino build side project so I can decode the Roomba IR remote and waste alot of time, and tear apart the Create 2, ( I also assume the schematics are proprietary) ......here are my questions.....

Does the Create 2 hardware include a separate IR receiver and transmitter that works in parallel with the serial interface (so I can optically isolate the control signals and do away with the serial cable. )?
Does the Create 2 use IR sensors multiplexed to the home base for receiving the IR remote commands ?

Thanks for any info on a serial IR interface possibilities.

答:
RoanokeRoboticsClub whoop whoop! I'm based in the Roanoke area!

For your question, I would direct you to the Create2 Open Interface spec, pages 24-26, and ask if that's enough to answer your question and, if not, to please edit your question to include more specifics of what you're trying to do and why the information in the spec is insufficient.

To clarify, too, it looks like Packet IDs 17, 52, and 53,

...identifies the 8-bit IR character currently being received by [the respective sensor]. A value of 0 indicates that no character is being received. These characters include those sent by the Roomba Remote, Dock, Virtual Walls, Create robots using the Send-IR command, and user-created devices.

Emphasis added to highlight that you can make your own IR device and, presumably, your own values.

For compatibility, I would treat 0 and the character values listed in the table on pages 25-26 as "reserved" characters, and then you're free to use any other value, without "collision," to signal/flag your code to do whatever you want.


问:
funny behaviour or what - dc motor control
I'm trying to control the speed of this motor, with this motor driver and pic16f690.

pwm in my program

```<code>5 kHz frequency (0.2 ms period)
</code>```

Starting with 50% duty cycle the motor doesn't run.
But moving from say, 80% to 50% (i.e. program my PIC with 80% duty cycle, and then re-program it with 50%), the motor will run at 50% (of course at a lower speed). I consider this funny. Anyone to explain this?

my motor powered by 5V.

答:
If you're saying that it always starts with 80% PWM, but never with 50%, but it runs with 50% after starting, then you're just starting to learn the joys of working with a system that has significant stiction (AKA starting friction).

Somewhere buried in this document is a description, along with some prescriptions of how to deal with it in a closed-loop control system:
http://wescottdesign.com/articles/Friction/friction.pdf


问:
How to cope with an optical window limitation on 2D LiDAR?
I have a very small and cheap robot and I wanted to mount a 2D LiDAR on a bottom of it (3cm above the ground). It seems to be great as during the mapping the lidar will detect even small elevations from the ground.

But what happens when a chair will be in front of this LiDAR? I guess it will see only its legs due to a limited optical window (as it is 2D).
How can I cope with that? So my robot will not try to go under the chair.

This is the LiDAR: LINK

答:
The LiDAR won't go under the chair if your mapper inflates the occupied space created by the legs of the chair; ROS's move_base package does this automatically.

The problem with this approach is then the robot will have a harder time going through narrow corridors, doors, or hallways.


问:
what is the algorithm to get position (Linear displacement and linear velocity ) using IMU (Like MPU6050)?
So I have been working on a drone project for a very long time, now I decided to work on Kalman filter which is used widely nowadays like Ardupilot. I looked at the source code so basically understand that using double integration we can get linear displacement using IMU and GPS sensor fusion with Kalman filter. But when I run simple code for sample time 0.1s, I didn't get expected result. I run the code for  1 meter and distance I get was like sometimes 768cm or sometimes 2meters or even 100m so am little nervous about the algorithm.

What is the proper way to get linear displacement using IMU ?

答:
I thought for sure that there would have been a duplicate question somewhere on the site that answers this question, but I can't find one, so here's a quick description of the method.

Put your IMU in a known starting position and orientation (position + orientation = "pose").

Capture IMU accelerometer and gyroscope readings.

Use numeric integration on the gyroscope output (angle += gyroReading*deltaTime) to get the current orientation of the IMU.

Use the current orientation of the IMU to construct a rotation matrix that will transform the accelerometer readings from the IMU "body frame" of reference to the "world frame" of reference.

Use numeric integration on the transformed accelerometer output (speed += xfmAccelerometerReading*deltaTime) to get the current speed of the IMU in the world frame.

Use numeric integration on the world-frame speed (position += speed*deltaTime, or position += speed*deltaTime + 0.5*xfmAccelerometerReading*deltaTime*deltaTime) to get the current position of the IMU in the world frame.

GOTO: 2.

This is the most simplistic way of using an IMU output to get position. All sensors have a bias, though, so when you integrate the output you're left with a drift on the speed, position, and orientation estimates (important because they are estimates and not measurements).

You can use the gravitational "down" vector (the only sustainable long-term acceleration) to correct any drift on your x/y rotations. You can use a magnetometer/compass to correct any drift on your z rotation. You can use GPS to correct position drift.

I am a huge fan of the Madgwick filter and plug it every chance I get - it's free, open-source, outperforms the Kalman filter, and it's probably already written for you. It will take accelerometer, gyro, and magnetometer readings and give you the outputs.


问:
Doubt with linearization and discretization process - Ekf
In the paper "State Estimation for Legged Robots - Consistent Fusion of Leg Kinematics and IMU", the authors describe the application of an extended kalman filter to estimate states of a quadruped robot, where the equations used in the prediction phase of the kalman filter were equations 30 to 37:

Where $(r,v,q,p_1..p_n,b_f,b_w)$ represent the states: position of the main body, velocity, quaternion of rotation from the inertial coordinate frame to the body coordinate frame, the absolute positions of the $N$ foot contact points, accelerometer bias and gyroscope bias respectively. in addition, $C_k$, $g$, $f_k$ and $w_k$ represent: the rotation matrix corresponding to quaternion orientation, the gravity vector, the measured quantities of the accelerometer and gyroscope respectively.

The discrete linearized error dynamics matrix $F_k$ is represented by equation 44:

In addition, the authors introduce some auxiliary equations such as mappings and series, such as equation 13 which is a mapping of a rotation error vector in a quaternion, there is also the equation 20 where it is used to map the angular velocity in a matrix 4x4, and there are also equations 28 and 29 that are introduced to aid in the process of linearization and discretization of the models.

My first doubt is, what does this symbol below, used in the matrix $F_k$?

__

My second doubt is, the symbol $\omega^\times$ represents a skew-symmetric matrix of angular velocity, the resulting matrix of mapping 20 is a skew-symmetric matrix, I would like to know if the matrix $\omega^\times$ used in equations 28 and 29 is the matrix resulting from mapping the angular velocity in a 4x4 matrix (equation 20)?

My third doubt is, how to apply equation 28-29? as it is a series of powers ranging from 0 to infinity. Do I need to truncate it?

答:
concerning the first symbol, it represents the identity matrix of the appropriate size.

then equation (20) is used for (14)-(19) and the matrix is $\Omega(\omega)$, it applies for continuous space, for the Extended Kalman filter formulation $(.)^\times$ is the classical operator turning a vector into a skew-symmetric matrix.

lastly (290is (28) for $n=0$ and for arbitrary $n$ a close formed solution can be numerically evaluated as stated in the paper


问:
3D mapping on spinning 2D unit, and Lidar Resources?
Very new to Lidar but I am seeking to use Lidar in a project and have a Spinning 2d unit I made with garmins v3HP but. Now I am caught up on mapping, I was wondering if it was possible to do things like what is shown in the image with a spinning 2D. EDIT: I forgot to mention if anybody has any good resources on Lidar it would be a great help to me as I am new

Thank you.

答:
It is possible to create a pseudo 3D lidar with a 2D one. You have to add a motor or more specifically a servo that tilts the LIDAR. You can then continuously tilt the LIDAR and just integrate all the measurements together to form a 3D point cloud. If you look at this paper you can see an example of how they set this up in Fig 2. You can also use that paper as a reference for building your LIDAR mapping software.

Other papers you can take a look at with open source implementations are
BLAM,
HDL graph SLAM,
and many more just google LIDAR SLAM or LIDAR mapping.

Also you do actually need a proper 2D LIDAR to do any sort of mapping. From your post it looks like you have this https://buy.garmin.com/en-US/US/p/578152 which is called a LIDAR-lite, but is basically just a range finder.


问:
lb1847 stepper controller :how to connect to grbl atmega based board with step ,direction,enable , limit?
i like to use lb1847 chip with stepper motor "both salvaged from old copier"

i made grbl atmega board , this board gives step ,direction,enable and limit leads

so i tried to find corresponding pins on the lb1847 ,but data sheet only shows enable1 and enable2 pins and phase1 and phase2 pins???

so how can i connect the step and direction and enable pins of atmega to these pins of lb1847?!!

there are other logic pins on lb1847 chip to control current and decay .

if data sheet is required i van upload it.

thanks in advance

答:
So how can I connect the step and direction and enable pins of ATMega to these pins of LB1847?!

You can't. The LB1847 doesn't accept those as inputs. You'll need to write your own code to send the correct signals to the LB1847.

From the LB1847 datasheet, page 6 gives the "Sequence Table" for the first 32 (0-31) steps of a revolution. It looks like you'll need 12 digital output pins on your ATMega to interface with the LB1847; four current control pins, an enable, and a phase select, for six pins total for each phase (two phases, A and B, gives 12 total).

There's a drawing on page 11 that gives the first half of a revolution. It's not explicitly mentioned anywhere that I saw (in a brief reading of the datasheet), but I'm assuming that you would run the sequences 0-31, then invert the phase select pins PHA1 and PHA2 and run sequences 0-31 again, for a total of 64 steps (0-63) per revolution.

If you look again at the sequence table on page 6, you can see that Phase A's step 16 is to have the enable pin high (which disables the output), and Phase B's step 0 is also to have the enable pin high. From there on, Phase A and Phase B have the same current settings (Phase A's step 17 is the same as Phase B's step 1, etc.).

You could try to code something slick where you only have one phase defined, like Phase A, and then the other phase is the first phase plus an offset of 16 steps, but then you have to keep the PHA pin settings straight, etc.

Memory is generally so cheap that I'd just hard-code the entire table in an include file for your project. Probably I'd write the whole thing out to 64 steps, too, just being sure to invert the PHA settings.

Finally, you keep an internal count of which step you're currently on and write your own subroutine that accepts as inputs the values you're trying to send - direction, steps, enable.

Depending on what you want "enable" to mean, you can "logical OR" your enable (or !enable) with the enable pin determined by the sequence table to turn the stepper off. Then it's just a matter of incrementing (or decrementing) your current step count by the number of steps and ensuring that you wrap from 0 to 63 and from 63 to 0.


问:
Why innovation equation in Extended Kalman filter is called innovation?
In the Extended Kalman filter for SLAM, why is the innovation equation called so? Is there a reason for using the specific word "innovation" for the difference between the observed information and the predicted value?</p>

答:
From the Wikipedia entry:

In time series analysis (or forecasting) — as conducted in statistics, signal processing, and many other fields — the innovation is the difference between the observed value of a variable at time t and the optimal forecast of that value based on information available prior to time t. If the forecasting method is working correctly, successive innovations are uncorrelated with each other, i.e., constitute a white noise time series. Thus it can be said that the innovation time series is obtained from the measurement time series by a process of 'whitening', or removing the predictable component. The use of the term innovation in the sense described here is due to Hendrik Bode and Claude Shannon (1950) in their discussion of the Wiener filter problem, although the notion was already implicit in the work of Kolmogorov.

The especially noteworthy bit in that text is that, "if the forecasting method is working correctly, successive innovations ... constitute a white noise time series."

This means that you should be able to apply a feedback based on the innovations and, in the long-term, that feedback won't do anything if your predictions are correct.

To put it another way, feedback based on innovations will only change your filter parameters if your filter isn't making accurate predictions. This is the heart of how and why the Kalman filter works as well as it does - it tunes itself until it is making good predictions and then stops tuning.


问:
Why does the low variance resampling algorithm for particle filters work?
I am studying and coding particle filters and I am using the Low variance sampling algorithm suggested in the Probabilistic Robotics book. I understand the procedure for the algorithm. A random number r is picked from the interval (0, 1 / M) and a variable U, calculated based on r is used to navigate the sample space systematically. A variable c(cumulative sum) is initialized with the first weight, and incremented by adding weights until it is higher than U. Once the cumulative sum is higher than U, it picks the sample corresponding to the weight last added.

The problem that I have is that I don't see how this picks up a good sample set for the next iteration. This seems very random or at least favorable to lower valued weights. If the initial value of r is very low, U is also low initially and it may pick a sample whose weight is low, unless weight vector is sorted from high to low (Is it sorted?). However, this video suggests that particles with higher weight have a better chance of getting picked. The algorithm doesn't convey this idea to me. Please help if you have an explanation.

答:
The algorithm can be understood by taking an example (using variables used in Probabilistic Robotics and algorithm in table 4.4 in page 110 in the same book).

Algorithm: (Couldn't get math mode to work inside code mode. Hence the picture.)

Consider $M = 100$

$M^{-1} = 0.01$

Let $r = 0.005$

So, $U = 0.005, 0.015,......., 0.995$ as loop progresses.

If the weight is assumed to be initialized with a value of 1/no. of particles, the first iteration of the algorithm will pick a particle, due to low value of U. Here no. of particles is 100. But in later iterations, the value of U will be larger and that would mean that by the time the value of c catches up with U, a lot of particles corresponding to lower weights will be skipped due to the inner while loop. At the same time, if c had a large increment due to large weight, it will take a while for U to catch up with c. This means the while loop will be skipped and high weight particle will be added to the output set multiple times. This is how high weight particles are picked by the algorithm. Also, the maximum value of U is 0.995, in this case. Even if r is higher, this maximum value will not exceed 1. This means, at some point, c will catch up with U resulting in selection of particles, assuming weights are normalized.


问:
A* search results in path too close to obstacles
I have a configuration space as below with several obstacles. Green circles are all the points I need to go to. Blue line is the path returned from A* search.

However, I am looking for path that's smoother and away from obstacles. what can I do?

答:
Obstacle padding/ robot padding.

Suppose you are working in a 2D environment and that you have an obstacle of the size 2x2. When doing planning (graph search, etc.), you increase the size of the obstacle to, for example, 3x3. Then when you find a path, the path is guaranteed to be at least of the distance 1 away from the actual obstacle.

As for a smoother path, you may apply some shortcutting procedure on the path found by your path planner. Searching for shortcutting or trajectory shortcutting should give you a number of results.


问:
Calculate position of differential drive robot
How do you calculate or update the position of a differential drive robot with incremental sensors?

There is one incremental sensor attatched to each of the two differential wheels. Both sensors determine the distance $\Delta left$ resp. $\Delta right$ their wheel has rolled during a known time $\Delta t$.

First, let's assume the center between both wheels marks the position of the robot. In this case, one could calculate the position as:

$$
x = \frac{x_{left}+x_{right}}{2} \\
y = \frac{y_{left}+y_{right}}{2}
$$

"Deriving" those equations under the assumption that both wheels rolled in a straight line (which should be approximately correct for small distances) I get:

$$
\frac{\Delta x}{\Delta t} = \frac{1}{2}\left( \frac{\Delta left}{\Delta t} + \frac{\Delta right}{\Delta t}\right)cos(\theta) \\
\frac{\Delta y}{\Delta t} = \frac{1}{2}\left( \frac{\Delta left}{\Delta t} + \frac{\Delta right}{\Delta t}\right)sin(\theta)
$$

Where $\theta$ is the angle of orientation of the robot. For the change of this angle I found the equation

$$
\frac{\Delta \theta}{\Delta t} = \frac{1}{w} \left( \frac{\Delta left}{\Delta t} - \frac{\Delta right}{\Delta t}\right)
$$

Where $w$ is the distance between both wheels.

Because $\Delta x$ and $\Delta y$ depend on $\theta$, I wonder whether I should first calculate the new $\theta$ by adding $\Delta \theta$ or if I should rather use the "old" $\theta$ ? Is there any reason to use one over the other?

Then, let's now assume the center between both wheels does not mark the position of the robot. Instead I want to use a point which marks the geometric center of the robot's bounding box. Then $x$ and $y$ change to:

$$
x = \frac{x_{left}+x_{right}}{2} + l\, cos(\theta)\\
y = \frac{y_{left}+y_{right}}{2} + l\, sin(\theta)
$$

"Deriving" the first gives:

$$
\frac{\Delta x}{\Delta t} = \frac{1}{2}\left( \frac{\Delta left}{\Delta t} + \frac{\Delta right}{\Delta t}\right)cos(\theta) - l\,sin(\theta)\,\frac{\Delta \theta}{\Delta t}
$$

Now there is a dependance on $\Delta \theta$. Is this a reason to use the "new" $\theta$ ?

Is there any better method to do simulatenous update of position and orientation? May be using complex numbers (same approach as with quaternions in 3D?) or homogeneous coordinates?

答:
To answer your first question: if you really want to find the true kinematic equations for differential drive, I wouldn't start approximating by assuming that each wheel has moved in a straight line. Instead, find the turning radius, calculate the center point of the arc, and then calculate the robot's next point. The turning radius would be infinite if the robot is moving straight, but in the straight case the math is simple.

So, just imagine that over each time step, or each time you calculate the change in the incremental sensors, the robot travels from point A to point B on an arc like this:

Here's some sample code with the math simplified:

```<code>// leftDelta and rightDelta = distance that the left and right wheel have moved along
//  the ground

if (fabs(leftDelta - rightDelta) < 1.0e-6) { // basically going straight
    new_x = x + leftDelta * cos(heading);
    new_y = y + rightDelta * sin(heading);
    new_heading = heading;
} else {
    float R = unitsAxisWidth * (leftDelta + rightDelta) / (2 * (rightDelta - leftDelta)),
          wd = (rightDelta - leftDelta) / unitsAxisWidth;

    new_x = x + R * sin(wd + heading) - R * sin(heading);
    new_y = y - R * cos(wd + heading) + R * cos(heading);
    new_heading = boundAngle(heading + wd);
}
</code>```

I used similar math in a simulator to demonstrate different ways of steering: http://www.cs.utexas.edu/~rjnevels/RobotSimulator4/demos/SteeringDemo/

Body:
To answer your first question: if you really want to find the true kinematic equations for differential drive, I wouldn't start approximating by assuming that each wheel has moved in a straight line. Instead, find the turning radius, calculate the center point of the arc, and then calculate the robot's next point. The turning radius would be infinite if the robot is moving straight, but in the straight case the math is simple.

So, just imagine that over each time step, or each time you calculate the change in the incremental sensors, the robot travels from point A to point B on an arc like this:

Here's some sample code with the math simplified:

// leftDelta and rightDelta = distance that the left and right wheel have moved along
//  the ground

if (fabs(leftDelta - rightDelta) < 1.0e-6) { // basically going straight
    new_x = x + leftDelta * cos(heading);
    new_y = y + rightDelta * sin(heading);
    new_heading = heading;
} else {
    float R = unitsAxisWidth * (leftDelta + rightDelta) / (2 * (rightDelta - leftDelta)),
          wd = (rightDelta - leftDelta) / unitsAxisWidth;

    new_x = x + R * sin(wd + heading) - R * sin(heading);
    new_y = y - R * cos(wd + heading) + R * cos(heading);
    new_heading = boundAngle(heading + wd);
}

I used similar math in a simulator to demonstrate different ways of steering: http://www.cs.utexas.edu/~rjnevels/RobotSimulator4/demos/SteeringDemo/


问:
ROS CMakeLists.txt confusion
I am using Ubuntu 16.04 LTS with ROS Kinetic distro.

I have a custom package called gps_msgs in my catkin_ws directory. I have other two packages that utilize the message by including it into source.

Now, one of the packages doesn't build without having "gps_msgs" inside the find_package() macro in CMakeLists.txt whereas the other one does.

The packages are nearly identical apart from the fact that one of them utilizes a 3rd party library. Here's the CMakeLists (package.xml files are almost identical, none of them include gps_msgs, I would like to know why that works too..):

Package #1:

```<code>cmake_minimum_required(VERSION 2.8.3)
project(can_control_node)

add_compile_options(-std=c++11)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
)

include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

add_executable(can_control_node src/control_node.cpp)
target_link_libraries(can_control_node ${catkin_LIBRARIES})
</code>```

Package #2:

```<code>cmake_minimum_required(VERSION 2.8.3)
project(gps)

add_compile_options(-std=c++11)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  std_msgs
)

catkin_package(
  #CATKIN_DEPENDS std_msgs roscpp
  #INCLUDE_DIRS include
)

set(SOURCES
  src/an_packet_protocol.c
  src/spatial_packets.c
  src/rs232.c
)

include_directories(include/<span class="math-container">${PROJECT_NAME} $</span>{catkin_INCLUDE_DIRS})

add_executable(gps_node
  src/gps_node.cpp
  ${SOURCES}
)

target_link_libraries(gps_node ${catkin_LIBRARIES})
</code>```

Again, both packages have #include <gps_msgs/Navigation.h> in their source files. The gps_msgs/Navigation isn't mentioned AT ALL in either of the package.xml files. Package #1 builds, package #2 complains that gps_msgs/Navigation doesn't exist. All 3 packages are in separate directories in my catkin_ws, what's going on?

答:
I have managed to fix the issue.

I am still uncertain as to why it happens, catkin can be very unpredictable and what builds on one system doesn't builds on another one (experienced that yesterday).

This is an actual convention and has to be followed to achieve proper building sequence whenever you're trying to include a c:

Add your message in package.xml in the <depend>your_msg</depend> tag.

Add your message in CMakeLists.txt in the find_packages(catkin REQUIRED COMPONENTS roscpp your_msg) macro.

Add include_directories(include ${catkin_INCLUDE_DIRS}) macro in CMakeLists.txt to get the message headers.

Use add_dependencies(your_node ${catkin_EXPORTED_TARGETS}) macro in CMakeLists.txt to ensure that your messages are built first before building your target (most important step).

Hope this helps someone who is getting (message no found error during catkin_make).

Reference: catkin docs

Title: ROS CMakeLists.txt confusion


答:
Most planning algorithms reduce your robot to a point and plan a path for that point. The arising problem is exaclty what you are facing. As suggested before, obstacle padding is one of the methods, but generally, the configuration space has been proposed to solve this problem.

Configuration space is a more advanced and more general way of padding obstacles. The obstacles are enlarged by the dimentions of the robot, considering also the robot's orientation. A more detailed description can be found here.

In order to smooth your paths:

you can introduce penalties in A* for non-smooth portions of the path. However, since A* can only plan in discreet envionments, some degree of discontinuity will alwazs be present

you can use methods which take into account the dynamic limits of your system (dynamic window)

make A* plan an even more coarse path and fit splines on those waypoints to make sure that the obtained path is smooth

you can post-process the paths to smooth them out with a filter

Smoothing will introduce slight deviations in the path, so make sure to consider possible collisions after smoothing also.

Title: A* search results in path too close to obstacles

Body:
I have a configuration space as below with several obstacles. Green circles are all the points I need to go to. Blue line is the path returned from A* search.

However, I am looking for path that's smoother and away from obstacles. what can I do?


问:
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'm not sure if an 'aquabot' is a fully submersible vehicle, or a surface one.

If it's a surface vehicle, then you just need to look at RC boats. They've got this solved pretty well.

The seal that prevents water entering the boat is called a stuffing box (4 on the diagram). It's simply a tube stuffed with grease. The grease prevents any water leaking into the boat between the tube and the propeller shaft. Usually there's about a 1mm or so gap between the shaft and the inside of the tube, so that it can hold plenty of grease. The ends of the tube have loose bushings fitted which hardly contribute any friction, but prevent the grease escaping.

This will probably work well even for fully submersible vehicles, as long as they don't go too deep. As you go deeper, the pressure will begin to force water up the tube, pushing the grease out, and eventually letting water into the boat.

One way to combat this is to simply push back. Increase the air pressure at the other end of the stuffing box so that things stay balanced. One way to do this is to enclose the motor and the inside end of the tube inside a small sealed box. Use a tiny pump to pressurize the box to match the water pressure.

Alternatively, why not let the water do the work for you? Seal the motor inside a rubber bladder and house it outside the boat. The water pressure will compress the bladder so that the air pressure inside always matches the pressure outside perfectly.

My final suggestion is similar to Mark Booth's. Why not build a motor which can cross the hull of the vehicle. Put the magnets of the motor outside, and keep the windings inside where it's dry. What you will be making here is basically a Brushless Motor:

You could maybe build this into something like a ducted fan.