答:
Depending on which area of robotics you would like to specialize in, knowing what assembler is and how it should be used might indirectly help you to write more efficient code. It helps you less in industrial robotics, it helps you more in diy robotics. However, I doubt that you will ever write asm code, but I am sure that a solid understanding of bit and hex representation of variables will help you a lot. Assembler can give you this knowledge at a steep learning curve.

Since I think that general knowledge about assembler helps you, not specifically one complex mcu, I would recommend learning a simpler arhitecture like avr (arduino) at a low level (just to know how assembler works) It offers you a good insight into porgrammjng but you will most probably never write assembly code directly.

Furthermore, I would recommend knowing C/C++ well, since most microcontroller applications are written using these languages.

Title: Learning micro-controller programming

Body: Is learning microcontroller programming useful for one who want to specialize in robotics I don't mean platforms like Arduino , Teensy , I mean mcu itself like Arm cortex etc.</p>


问:
How many solutions are there to this?
I'm studying for an exam and I came across these questions where you have to determine the number of possible inverse kinematic equations like (qs from Craig Introduction To Robotics, 3rd Edition)

How exactly do you find the number of solutions? I know how to find the DH parameters and then the inverse kinematics but is there some way to calculate the number of solutions quickly like this question suggests? Like, I can visualize it (4 for the second one) but is there a proper way?

答: The number of solutions come from the multiple solutions to the inverse kinematics equations. You can easily develop an intuition for different groups of mechanisms and identify correctly the number of solutions, but this is based on experience and intuition, not on a mathematical formalism. This however is only the theoretical side of the problem. In practice, the joint limits play an important role in limiting the number of theoretical solutions practically achievable. </p>

ContentLicense: CC BY-SA 4.0

Title: How many solutions are there to this?

ContentLicense: CC BY-SA 3.0


问:
How to seal a threaded rod so I won't lose oil?
I have an M5 threaded rod that penetrates a box. Outside it is driven by a motor and it rotates a part inside the box. The box is sealed and I would like to seal the area around the rod as well. I have seen double lip oil seals but I don't think they will work.

The oil is very runny, like water and the reason I am not using a smooth rod (which would be simpler to use in this application) is mainly in order to save on tooling costs as I can get the rods already threaded for very cheap.

Any help would be appreciated!

答:
Have you considered putting the motor inside the same oil-filled box as the part that needs to move?

Many electric motors -- such as the coolant motor in practically all household refrigerators -- run in a bath of oil. Electric motors often work better covered in oil than they do dry.

Sealing a hole with an electric cable running through it is much easier than sealing a hole with a rotating rod running through it.


问:
How to tilt a camera 180 using mirrors
How would you vertically tilt a camera 180 degrees using mirrors?

I'm trying to add a pan/tilt mechanism to a Raspberry Pi's camera. The camera uses one of those flat cables with unstranded wires, and even with a strain gauge, I don't trust it to handle repeated bending, so I'm trying to design a tilt mechanism that allows the camera to be rigidly mounted so no wires move. The tilting also has to happen very quickly, so I'm trying to minimize the amount of mass I need to move.

Then I saw the Oculus kit that actuates a mirror to effectively tilt a laptop's fixed webcam. I'm trying to extend this idea, but I having trouble working out the mechanics that would allow the tilt to extend to 180 degrees. The layout in the Oculus's mechanism only supports a tilt angle of about 90 degrees, and the mirrors are relatively large. Is it possible to modify this to support 180 degrees?

Are there other ways to "bend" the view of a camera without having to move the actual camera?

答:
Perhaps a mirror tilted 45 degrees on the end of a motor shaft might work?

top view, camera looking horizontally:

```<code>                 .
                 .
                 ./
[camera]<| . . . /=== motor
                /
</code>```

front view, camera looking horizontally directly at you:

```<code>[camera]<| . . . |(mirror)|===(motor)
   ||                            ||
  ---------------(ground)-----------
</code>```

front view, camera looking down:

```<code>[camera]<| . . . . . \========(motor)
   ||                .           ||
  ---------------(ground)-----------
</code>```

front view, camera looking up:

```<code>                     .
                     .
                     .
[camera]<| . . . . . /========(motor)
   ||                            ||
  ---------------(ground)-----------
</code>```

Forgive the crude ASCII art. I hope this makes sense to you.

Title: How to tilt a camera 180 using mirrors

Body:
Perhaps a mirror tilted 45 degrees on the end of a motor shaft might work?

top view, camera looking horizontally:

                 .
                 .
                 ./
[camera]<| . . . /=== motor
                /

front view, camera looking horizontally directly at you:

[camera]<| . . . |(mirror)|===(motor)
   ||                            ||
  ---------------(ground)-----------

front view, camera looking down:

[camera]<| . . . . . \========(motor)
   ||                .           ||
  ---------------(ground)-----------

front view, camera looking up:

                     .
                     .
                     .
[camera]<| . . . . . /========(motor)
   ||                            ||
  ---------------(ground)-----------

Forgive the crude ASCII art. I hope this makes sense to you.


问:
Reliability of Raspberry Pi in Wild Life Guardian Drone project
I'm new here, my name is Mark, I'm 24 years old and I'm a Linux lover, by 2020 I intend to build up a wildlife guardian drone based on the Raspberry pi which will be connected to the internet but that will operate by its own using artificial intelligence.

Talking about this to a technician at my school in Italy, I have been told that the Raspberry is not suitable for an important project but just for little experiments.

The way he said that seemed to me just a bit too dismissive but he made me become doubtful about the Raspberry's quality so I hope you guys can help me understand if the Raspberry can suite my ambitious plan to build a guardian drone to protect the wildlife of a very little Papua New Guinea island or if it will break the first time it encounters trouble.

Is the Raspberry pi 3 only for little experiments or will it also work for very important stable projects like building robots?

答:
From what I've seen other people using RaspberryPi, they sometimes had reliability issues with it when used in bad conditions (Thrown around in boxes, lots of interference, dubious power supplies and cables -- This was when they were used for driving displays at a competition, not in robotics though), so there might be a point to what people at your school tell you.

But while building a robot, you will likely be doing a lot of little experimenting anyway :). You can start with a RaspberryPi if you have it available and then move to something else if you find out it's not good enough for you. Buying some expensive hardware only to find out a month later that you actually needed the other one is not so much fun :-)


答:
If you want your drone to operate by itself, it must have some degree of intelligence, which means powerful computation resources are needed.

Assuming you intend to use computer vision for the drone to navigate, then it needs to process video stream real time, which is far beyond what Raspberry can do. However, if you construct an super "elegant" AI, a Raspberry would suffice. But this takes a lot of effort. MIT has built a system that can make an aircraft navigate in the forest, which is very impressive. Since details of the project is not shown in the question, I don't know what kind of intelligence it requires.

By the way, Raspberry alone is not capable of controlling a drone. You are going to need ESC(electronic speed control) to control the motors.

Another solution is that the drone transmits all data to the server, where AI algorithms process the data then give the drone commands. But the method involves other problems. First, it's hard for the drone to transmit the data for long distance. If you want to make the wireless communication reliable and keep the cost down, 2Km might be the limit on complicated terrain. In your case, 2Km may be able to cover the island. You also need to make sure the transmitter won't overheat during operation. Second, real-time processing cannot be guaranteed. If the velocity of  your drone surpass 20m/s, the command delay would be a disaster.

In conclusion. Raspberry is not well-suited for your project, but it's still possible. I found that innovation often comes from those outsiders. So try it, even others tell you it's not possible. Some axiom may be true, but they are only applicable to most people in most conditions, not all.

Title: Reliability of Raspberry Pi in Wild Life Guardian Drone project

Body:
I'm new here, my name is Mark, I'm 24 years old and I'm a Linux lover, by 2020 I intend to build up a wildlife guardian drone based on the Raspberry pi which will be connected to the internet but that will operate by its own using artificial intelligence.

Talking about this to a technician at my school in Italy, I have been told that the Raspberry is not suitable for an important project but just for little experiments.

The way he said that seemed to me just a bit too dismissive but he made me become doubtful about the Raspberry's quality so I hope you guys can help me understand if the Raspberry can suite my ambitious plan to build a guardian drone to protect the wildlife of a very little Papua New Guinea island or if it will break the first time it encounters trouble.

Is the Raspberry pi 3 only for little experiments or will it also work for very important stable projects like building robots?


答:
By all means start with a raspberry pi and see where that leads you. If you write your AI, control and other algorithms nice and modular, moving to another platform would be quite simple, and shouldn't be a problem since this is a long-term project. Afterall, you would still be using Linux, gcc, glibc and all sorts of libraries that are portable across Linux distributions and the architecture is running on.

One thing I often experience is that version 1 of anything is very flawed. It's hard to predict all the requirements and challenges of a problem beforehand, so version 1 ends up being patched over patched and ugly. Learning everything from that, version 2 becomes a much better design, more efficient and overall much better. So start with a raspberry pi, knowing that you might even decide to redo the whole thing after initial experimentation, at which point you would be glad you didn't waste a long time trying to find the best platform to do something you weren't entirely sure what it was!


答:
There is no definite answer to your question. In any case you should define specific requirements for you system, including:

processing power needed

maximum power consumption

operating temperature range

should the system be dust/water proof

What's more, for a drone you will probably need additional board for running motors control loop. Raspberry isn't a good choice here because of real time requirements, but can be good choice for higher level control unit (image processing, navigation etc.) Even if it fails, the motor control could be programmed to safely get a drone to the ground by slowly lowering altitude.

As Shahbaz said, at prototype stage it is a good choice. You will probably want to change it at some point, but first gather more experience on the project.


问:
How to transform Accelerometer data from the robots frame to the world frame
I'm current workin on an EKF for an carlike robot and I'm not sure how to transform the IMU accelerometer data to offset the roll, pitch and yaw and get the acceleration with respect to the ground.
I'm only computing the x,y position of the robot and the yaw of this vehicle.</p>

答:
If you are only computing the x, y and yaw (as I understand, these are the degrees of freedom of the robot) then:
 1. The yaw acceleration is just what you measure
 2. x and y acceleration is what you measure but rotated by the yaw angle (e.g phi) around the z axis. So you just need to rotate it back to the world frame. you can do it with this rotation matrix multiplied by the x, y vector:

(cos(phi), sin(phi); -sin(phi), cos(phi)) * (x, y)

I dont understand what do you mean by:

transform the IMU accelerometer data to offset the roll, pitch and yaw

Assuming the ground is flat and the IMU z axis is in the same direction of the world z axis (perpendicular to the gound), you shouldn't have changes in the roll and pitch.

If you do want to take them into account, you should take the roll, pitch and yaw angles and transform your measurements with one of the methods stated here.

Usually, in robotics, the Quaternions are used for this purpose.


问:
Why is this electro motor going slower?
From an old dust buster I've got this electro motor, the included battery pack and the charger:

I ripped everything apart (the dust buster was broken) and the motor still works. After playing around with it for a while and letting it lying around for about two weeks it suddenly revs a lot slower. I supposed the battery pack was drained so I hooked up the battery pack to the charger and let it charge for a night. Unfortunately the motor still turns very slow.

Since I want to use this motor for my first home robotics project (making a kite fly with my computer), off I went to the local electronics store where they measured the charger to give 16V (even though it says 21V) and the battery pack to give about 5V. I then hooked up the motor directly to the charger, but unfortunately it doesn't even move an inch then.

So now I wonder:

Why doesn't the motor spin at all when hooking it up to the charger? (Could that be because the 250mA is too low?)

Why doesn't the battery pack charge at all? (this bothers me the most!)

All tips are welcome!

答:
250mA states the maximum output current to drive the load. So check what the current rating of the 5V regulator is.

Check whether there is a voltage drop before reaching the motor. It might be that the motor is not spinning because of insufficient supply.

Change the adapter you are using. If it is marked 21V, the output from adapter will be around 20.5V to 21.5V.

Title: Why is this electro motor going slower?


问:
How does Amazon ensure its drones are not shot down or captured when in service
If Amazon plans to deliver packages using drones, how does it ensure the drones reach their destination safely and come back? Won't thieves be able to easily steal packages and drones by shooting them down? What about threat from birds like falcons?</p>

答: Mister Frauke Zeller is a researcher in the field of "how the environment reacts to robots". He questions about how a robot have to be designed in a way that his human environment acts in a friendly or not so friendly manner. The best example is the hitchbot project, which was not a experiment on how to create a robot, but a study what people will do if they see such robot Post-hitchBOT-ism. There are also experiments in the wild, how birds are interacting with drones DRONES UNDER ATTACK - Drone Fails.</p>


问:
Tuning PID controller for sharp turns in line follower robot
I'm working on a TWDD line-following robot using qtr-8a reflectance sensor array.
The sensors are connected to BeagleBone Black, and BBB is sending the speed serially to an arduino Due.
My approach is using a PID controller for the sensor so the error equals to zero when the robot is centred on the line and a positive/negative error depending on the robot's position. Applying Trial and error method I finally reached a Kp value that tracks straight lines perfectly. However, I'm still unable to turn and stay on the line even on a similarly smooth turns. I guess this is related to the Kd value. I'm not using the integral part Ki since the error is keep increasing. I tried to set conditions when the robots is drifting away from the line but it's not working probably (even without the conditions it is somehow turning smoother but then losing the line)
I'm using the following draft code:

```<code>from bbio import *
import time

integral = 0
last_prop = 0
Kp = 20
Ki= 0
Kd = 150
amax = list(0 for i in range(0,8))
amin = list(1024 for i in range(0,8))
timeout = time.time() + 10

# Read ADC data from MCP3008
# ch: 0-7, ADC channel
# cs: 0-1, SPI chip select
# See MCP3008 datasheet p.21
def adc_read(cs, ch):
    spidata = SPI1.transfer(cs, [1,(8+ch)<<4, 0])
    data = ((spidata[1] & 3) << 8) + spidata[2]

    return data

def setup():
# SPI1 setup
    Serial2.begin(9600)
    Serial5.begin(9600)
    pinMode(GPIO1_7, OUTPUT)
    digitalWrite(GPIO1_7, LOW)
    SPI1.begin()
    SPI1.setMaxFrequency(0,50000)  # => ~47kHz, higher gives occasional false readings
  #  SPI1.setMaxFrequency(1,50000)
    calibrate()

# reading the IR sensor data
def read_sensors():
    sensors = []
    for i in range(8):
        sensors.append(adc_read(0,i))

    return sensors
# calculating the error from PID controller
def calc_pid(x,sp):
    global  integral, last_prop , Kp, Ki ,Kd
    set_point = sp
    pos = sensor_average(x)/sensor_sum(x)
    prop = pos - set_point
    integral = integral + prop
    deriv = prop - last_prop
    last_prop = prop
    error = (prop*Kp + integral*Ki + deriv*Kd)/100

    return error

def get_position(s):
    return sensor_average(s)/sensor_sum(s)

def sensor_average(x):
    avg = 0
    for i in range(8):
        avg += x[i]*i*100

    return avg

def sensor_sum(x):
    sum = 0
    for i in range(8):
        sum += x[i]
    return sum

def get_sensor(x):
    j= read_sensors()[x]
    return j

def calc_setpoint(x,y):
    avg = 0
    sum = 0
    for i in range(8):
        avg += (x[i]-y[i])*i*100
        sum += x[i]-y[i]
    return avg/sum
# calibrate the sensors reading to fit any given line
def calibrate():
    global amin
    global amax

    while(time.time() < timeout):
        for i in range(0,8):
            amin[i] = min(amin[i],read_sensors()[i])
            amax[i] = max(amax[i],read_sensors()[i])
            digitalWrite(GPIO1_7, HIGH)
    digitalWrite(GPIO1_7,LOW)

# calculating the correspondent speed
def calc_speed(error):
    avg_speed = 150
    min = 100
    pos = get_position(read_sensors())
    speed = []
    if(error < -35):
        right = avg_speed -(2*error)
        left = avg_speed + (2*error)
    elif(error > 35):
        right =avg_speed - (2*error)
        left = avg_speed + (2*error)
    else:
        right = avg_speed - (error)
        left = avg_speed + (error)
    speed.append(right)
    speed.append(left)
    return speed

def loop():

    s = read_sensors()
    setpoint = calc_setpoint(amax,amin)
    position = get_position(s)
    err = calc_pid(s,setpoint)

    print err

    #print "divided by 100:"
    speeds = calc_speed(err)
    print speeds
    right_motor = speeds[0]
    left_motor = speeds[1]

    Serial2.write(right_motor)

    Serial5.write(left_motor)
    delay(10)

run(setup,loop)
</code>```

PS: the sent speed over serial is limited to 255 and I'm multiplying it by a factor from the Arduino side.

答:
While calculating speeds, you are multiplying by 2*error. If PID (or PD) calculates an error, I believe it should be fed directly to the motors because in each loop it does not account for an additional 2* multiplier in speed in the next loop. That would act like an unforeseen impulse that is unaccounted for by the PID. So for starters, I would suggest try removing the 2*error term, compare to a smaller error (or as required) and go without the last else-if condition like below:

```<code>if(error < -20):
        right = avg_speed -(error)
        left = avg_speed + (error)
elif(error > 20):
        right =avg_speed - (error)
        left = avg_speed + (error)
</code>```

Secondly; If you are going with hit-&-trial calculation of the PID constants, I would suggest, start with just P and get a decent line following (with manageable oscillations at low speeds). Then add an integral term (PI controller) and test it out.The Differential term can be added once the other two are giving a suitable response.

Body:
While calculating speeds, you are multiplying by 2*error. If PID (or PD) calculates an error, I believe it should be fed directly to the motors because in each loop it does not account for an additional 2* multiplier in speed in the next loop. That would act like an unforeseen impulse that is unaccounted for by the PID. So for starters, I would suggest try removing the 2*error term, compare to a smaller error (or as required) and go without the last else-if condition like below:

if(error < -20):
        right = avg_speed -(error)
        left = avg_speed + (error)
elif(error > 20):
        right =avg_speed - (error)
        left = avg_speed + (error)

Secondly; If you are going with hit-&-trial calculation of the PID constants, I would suggest, start with just P and get a decent line following (with manageable oscillations at low speeds). Then add an integral term (PI controller) and test it out.The Differential term can be added once the other two are giving a suitable response.


问:
Do I need extra software on the EV3 to use Robotary?
Do we need to install extra software on the EV3 or does Robotary (https://robotaryapp.com/) install programs just like the default LEGO Software.

Thanks, Josh

答: I contacted the developers and no, you do not need external software, but your mac has to be running for the software to work on the EV3. They are connected via bluetooth or USB.</p>


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

答:
You would have to do both. It's very very challenging to move an object without using hardware, and it's incredibly hard to see the colour of a brick with hardware.

You'd have to break it down into a few pieces:

Hardware

Shape and size (you can't detect the size and shape with a robot easily)

Movement of pieces

Software

Color

Patterns


问:
How can I implement tremaux algo in arduino line follower to navigate and create map?
The Map1

The task is divided into 2 runs, In first run, We have to navigate through whole map and reach the end mark taking all checkpoints.
In second run, using the mapping from first run we have to follow the shortest path.

I am reading Algos and codes from days, I know the steps that should be taken,
Navigate the maze using Tremaux algo and turning right at each possble junction.
then Save that map in memory and use djikstra algo or A* algo to find the shortest path.
But how to implement it practically?

Also since all  the dictances and angles are known and also the wheel dia, motor rpm, bot width then Can I skip wheel encoders and use calculation instead?

答:
I would highly recommend using the encoders over estimating travel distance by rpm + time.  Estimating motor velocity is notoriously tricky.  Especially at slow speeds.  </p>

<p>A direct measurement is always better.  </p>

Body:
I would highly recommend using the encoders over estimating travel distance by rpm + time.  Estimating motor velocity is notoriously tricky.  Especially at slow speeds.

A direct measurement is always better.


问:
Could anyone complete my challenge?
Earlier while writing by hand, I was wondering if anyone could build a pen holder, that could write for me? Maybe you could make some good business from them. Thanks for your time.</p>

答:
Yes, robotic arms or other devices could write for you.

They can even be more prolific than Shakespeare.

But probably the poetry they write is not your desideratum.

If you plant numerous electrodes in your head to monitor the spikes your neurons generate, the robotic arm may have a chance to share your thoughts thereby writing for you as you wish. However, I do not encourage you to try that. Because currently we do not have the technology at such an applicable level.

In short, the robotic arm doesn't know your heart.

So this is inevitably a heartbreaking story.

Title: Could anyone complete my challenge?


问:
Self balancing robot control system strategies
I’m in the early stages of designing a self-balancing robot as a way to refresh my knowledge on control theory, which has been gradually slipping away since graduating about a year and a half ago. I'm wondering if anyone has any input on how best to approach this problem.

My plan is to use a 6 DOF IMU as an angle sensor, and to control the pitch by accelerating and decelerating the cart. I'm looking for robust response to disturbance, and to add in RC differential drive capabilities later on. This block diagram is a pretty close match for what I was planning to do,  (source: Sebastian Nilsson's Blog):

Would this be a good approach? Any recommended alternatives? Thanks.

答:
I can recommend an alternative which has worked for me quite well.

I derived the dynamical model of a inverted pendulum, then linearised it around the stable operating point. With this simplified model I found the LQR controller which keeps my robot upright and tracks my desired linear and angular velocities.

The robot working: https://www.youtube.com/watch?v=USnkWeM0EHY

For learning more about control, linearising and LQR: https://www.coursera.org/learn/mobile-robot

For specific example with self-balance robot: Lecture 4.4 – The Segway Robot of the same course.

The paper which I based my derivation of the dynamical system: Dynamic Analysis of a Nonholonomic Two-Wheeled Inverted Pendulum Robot, YEONHOON KIM*, SOO HYUN KIM and YOON KEUN KWAK, Journal of Intelligent and Robotic Systems (2005) 44: 25–46


答:
If your charger is running at 16V instead of the 21V it's supposed to be operating at, then that is your problem.

Why your charger won't run the motor

Your charger should be fairly underpowered for running the motor.  Most batteries strong enough to power motors are not meant to be charged as fast as they can discharge.  This can be for several reasons, including:

Safety: some batteries will explode if charged with too much current

Longevity: some batteries will degrade if charged beyond what the chemistry can handle

A power supply capable of running the motor would be damaging (if not dangerous) to connect directly to the battery.

Other things to check:

It's possible that your batteries are running near the end of their lifetime (they have a finite number of cycles).  When charged overnight and unplugged, are their voltages below what they should be?

It could also be that the problem is mechanical.  Has debris been introduced into the motor assembly, or is it poorly lubricated?

Title: Why is this electro motor going slower?

Body:
From an old dust buster I've got this electro motor, the included battery pack and the charger:

I ripped everything apart (the dust buster was broken) and the motor still works. After playing around with it for a while and letting it lying around for about two weeks it suddenly revs a lot slower. I supposed the battery pack was drained so I hooked up the battery pack to the charger and let it charge for a night. Unfortunately the motor still turns very slow.

Since I want to use this motor for my first home robotics project (making a kite fly with my computer), off I went to the local electronics store where they measured the charger to give 16V (even though it says 21V) and the battery pack to give about 5V. I then hooked up the motor directly to the charger, but unfortunately it doesn't even move an inch then.

So now I wonder:

Why doesn't the motor spin at all when hooking it up to the charger? (Could that be because the 250mA is too low?)

Why doesn't the battery pack charge at all? (this bothers me the most!)

All tips are welcome!


问:
Gazebo: moving joint with model plugin
This is my first week with Gazebo.  The tutorials are clear (except for my dearth of C++ knowledge) but now that I'm working to move out on my own things are getting cloudy.  I made a model comprising two boxes and a revolute joint.  The file one_r_test.world loads this model.  A plugin is "loaded" (?) in model.sdf and that plugin, ModelControl, comes from model_push.cc in the "Model plugins" tutorial (http://gazebosim.org/tutorials?tut=plugins_model&cat=write_plugin), which uses SetLinearVel to move a box.  I can get this same behavior out of model_control.cc if I just copy the tutorial code (and change the plugin name as appropriate), but that's not what I want.  I'm seeking to eventually simulate joint control of robotic manipulators and what's not working in this basic simulation is my attempt to move the model joint via the ModelControl plugin.  It moves in the GUI if I set the velocity (or torque) that way.  The model_control.cc code is pasted below in hopes that you can identify a problem.

model_control.cc

```<code>
#include "boost/bind.hpp"
#include "gazebo/gazebo.hh"
#include "gazebo/physics/physics.hh"
#include "gazebo/common/common.hh"
#include "stdio.h"
// In the real file these quotes are greater-than and less-than but I
// don't know how to get that to show up in my question

namespace gazebo
{
  class ModelControl : public ModelPlugin
  {
  public: void Load(physics::ModelPtr _parent, sdf::ElementPtr /*_sdf*/)
    {
      // Store the pointer to the model
      this->model = _parent;

      // Store the pointers to the joints
      this->jointR1_ = this->model->GetJoint("r1");

      // Listen to the update event. This event is broadcast every
      // simulation iteration.
      this->updateConnection = event::Events::ConnectWorldUpdateBegin(boost::bind(&ModelControl::OnUpdate, this, _1));
    }

    // Called by the world update start event
  public: void OnUpdate(const common::UpdateInfo & /*_info*/)
    {
      // Apply a small linear velocity to the model.
      //this->model->SetLinearVel(math::Vector3(.03, 0, 0));

      // Apply angular velocity to joint
      this->jointR1_->SetParam("vel", 0, 99);
      this->jointR1_->SetParam("max_force", 0, 9999999999);

      double currAngle = this->jointR1_->GetAngle(0).Radian();
      printf("Current angle is \t %f\n", currAngle);
    }

    // Maybe I want to keep track of time?
    common::Time last_update_time_;

    // Pointer to the model
  private: physics::ModelPtr model;

    // Pointer to the update event connection
  private: event::ConnectionPtr updateConnection;

    // Pointers to joints
    physics::JointPtr jointR1_;
  };

  // Register this plugin with the simulator
  GZ_REGISTER_MODEL_PLUGIN(ModelControl)
}
</code>```

edit: If I change

this->jointR1_->SetParam("vel", 0, 99);

to

this->jointR1_->SetVelocity(0, 99);

then the joint moves (yes, very, very quickly).  What's wrong with SetParam vs SetVelocity?

答:
Your first line is:

```<code>virtual bool SetParam   (   const std::string &     _key,
unsigned int    _index,
const boost::any &  _value
)
pure virtual
Set a non-generic parameter for the joint.

replaces SetAttribute(Attribute, int, double) List of parameters: "friction" Axis Coulomb joint friction coefficient. "hi_stop" Axis upper limit. "lo_stop" Axis lower limit.

Parameters
[in]    _key    String key.
[in]    _index  Index of the axis.
[in]    _value  Value of the attribute.
</code>```

And the second one is based on this member function of joint class from Gazebo API here:

```<code>virtual void SetVelocity    (   unsigned int    _index,
double  _vel
)
pure virtual
Set the velocity of an axis(index).

Parameters
[in]    _index  Index of the axis.
[in]    _vel    Velocity.
</code>```

So yes your robot joint will move depending on the parameter _vel. Don't just depend on Gazebo Tutorials if you want to make your own robot, it's not enough. See also Gazebo API, if you're not good in C++ that much then first learn the important aspects of C++ like inheritance, access specifiers, object classes, friend functions.

Title: Gazebo: moving joint with model plugin

Body:
Your first line is:

virtual bool SetParam   (   const std::string &     _key,
unsigned int    _index,
const boost::any &  _value
)
pure virtual
Set a non-generic parameter for the joint.

replaces SetAttribute(Attribute, int, double) List of parameters: "friction" Axis Coulomb joint friction coefficient. "hi_stop" Axis upper limit. "lo_stop" Axis lower limit.

Parameters
[in]    _key    String key.
[in]    _index  Index of the axis.
[in]    _value  Value of the attribute.

And the second one is based on this member function of joint class from Gazebo API here:

virtual void SetVelocity    (   unsigned int    _index,
double  _vel
)
pure virtual
Set the velocity of an axis(index).

Parameters
[in]    _index  Index of the axis.
[in]    _vel    Velocity.

So yes your robot joint will move depending on the parameter _vel. Don't just depend on Gazebo Tutorials if you want to make your own robot, it's not enough. See also Gazebo API, if you're not good in C++ that much then first learn the important aspects of C++ like inheritance, access specifiers, object classes, friend functions.


问:
Handling GYROSCOPE BIAS DRIFT
I am working on a MEMS based project which requires me to calculate the orientation(Euler Angles) of an object using only GYROSCOPES.

The GYROSCOPE BIAS is calculated in the beginning for 2 seconds keeping it stationary.

Right now GYROSCOPES give me an accuracy of 2 degrees for a period of 3-4 mins of continuous movement.

Now if there is continuous movement beyond 3-4 mins, the GYROSCOPE BIAS would have changed and hence the errors increases rapidly.

My Question is:

1). If the bias drift changes randomly(as read),the angles start increasing in one direction, then why cant we track it for first ten seconds and then keep subtracting the present angles from  initially calculated angles,for every ten seconds during movement.

I tried this out, but it does not work as expected.

Can GYROSCOPE BIAS be tracked by any way?

Thanks in advance.

答:
You say,

Then why can't we track [the angles] for first ten seconds and then keep subtracting the present angles from initially calculated angles for every ten seconds during movement?

You can't subtract angles from a gyroscope reading because the gyroscope measures angular velocity. This is kind of like asking why you can't subtract your odometer reading in your car from your speedometer - you're talking about a distance and a speed. Well, an angle is an angular position or an angular distance, and again, the gyroscope measures an angular speed.

You can "calibrate" a gyroscope by controlling its speed (generally ensuring it's stationary) and measuring the output. Then you average the output and offset it such that it reads the known speed (again, this usually means averaging and subtracting whatever that average is from future readings).

The problem you'll have with trying to do this continuously is that the actual (physical) input to the gyroscope is probably not zero-mean. So, if you average the angular speed (angular velocity, angular rate, etc.) over some period of time, you don't have a good way of separating the actual input signal from the bias ("offset") of the gyroscope.

For example, if you read an average angular speed of 1.5 deg/s for 10 seconds, is that reading correct, or is it actually 1 deg/s and a bias of +0.5 deg/s, or is it actually 2 deg/s and a bias of -0.5 deg/s?

Here's the problematic part of what you're doing - when you take that average and subtract it from all future readings, you are mathematically stating that the gyroscope is, on average, stationary for that 10 second interval because the very next sample you get that says it's rotating at 1.5 deg/s, you're going to subtract the running average from that and get (1.5-1.5) = 0 deg/s.

The only way you can do what you're talking about - averaging angular speed and using that to correct future samples - is to know that the device will be "stationary" over the average of whatever your sampling interval is.

What you might be able to do is to take multiple units, and average their output, use that average as truth, and then conclude that the bias is the difference between the individual unit's reading and the averaged output.

So, if you had two units, and one read 1.5 deg/s averaged over 10 seconds, and the other read 2.0 deg/s averaged over the same interval, then you could say that the "true" motion was 1.75 deg/s, and the first unit has a bias offset of -0.25 deg/s and the second has a bias offset of +0.25 deg/s.

The more units you get, the better your results will be. It would of course be extremely important that the units are all rigidly coupled; any significant flexing of the substrate between sensors would ruin your data.

Title: Handling GYROSCOPE BIAS DRIFT


问:
SLAM for Autonomous car
I am working on SLAM for autonomous car like vehicles with 2D lasers and IMU (deriving odometry).

I would like to know how efficient is using the existing SLAM algorithms (for example: gmapping in ROS based on rao blackwellized particle filter).

till now i find MAP are high in volume and speed of vehicle is high and most importantly computational time compared to Mobile robots.

Are there  any other important factors to consider for car like vehicles in using SLAM algorithm.

答: I think you should look comparison of SLAM algorithms. There is a benchmark list for visual odoemetry/SLAM in Karlsruhe Institue of Technology named KITTI Vision Benchmark Suite. Their bench marking includes  Stereo vision and Laser Points</p>

Title: SLAM for Autonomous car


答:
Gmapping is a good algorithm if you can modify it to meet your needs.

"I would like to know how efficient is using the existing SLAM algorithms" ?

If you're new to the world of slam, you'd better use already developed algorithms or use one of them as a starting base.

Title: SLAM for Autonomous car

Body:
I am working on SLAM for autonomous car like vehicles with 2D lasers and IMU (deriving odometry).

I would like to know how efficient is using the existing SLAM algorithms (for example: gmapping in ROS based on rao blackwellized particle filter).

till now i find MAP are high in volume and speed of vehicle is high and most importantly computational time compared to Mobile robots.

Are there  any other important factors to consider for car like vehicles in using SLAM algorithm.


问:
Resources for object detection with 2D Laser Scanner (planar only)
Would you happen to know some good books, tutorials or articles on how to detect objects and their poses, using 2D laser scanners?

My goal is to equip a mobile robot with a laser scanner for object detection in a industrial like environment. I would like to detect legs, some pallets and some trolleys, and measure their poses as well.

My first intuition is extracting lines from the 2D readings. But then I'm somewhat lost in the next steps.

答:
I think you can divide your problem into two subproblems:

1) Partition your 2D scan into segments/clusters which represent single objects. A basic algorithm could be:

Start at first laser reading and create a new cluster

Add next reading (neighbor) to cluster, if the range difference is below a threshold

Else create a new cluster

This approach can be enhanced with a slightly better "adding-condition" (2.) as demonstrated in e.g. http://www.ipb.uni-bonn.de/wp-content/papercite-data/pdf/bogoslavskyi16iros.pdf but applied in 2D.

2) Find labels for those clusters (leg, pallet, trolley etc.) -Classification. For this purpose you need to find features/properties of clusters, e.g. width, depth (max. range difference) or gather data and make use of classification algorithms like SVMs etc.

Especially 2) seems to be vary hard using only a 2D laser scanner. One also could imagine to combine multiple scans and create a map (-> SLAM algorithms) which also contains your obstacles, and subsequently find and classify the objects. For this purpose, ROS ("Robot Operating System") is a good starting point as many algorithms, such as SLAM, e.g. http://wiki.ros.org/gmapping, are already implemented.


问:
Proportional controller with state feedback controller
I have a transfer function G(s)=1/s(s+10) with sampling and holding, it is easy to relocate poles at 0.5 and -0.5 using a state feedback controller. But if the proportional controller is added to the transfer function, as in G(s)=K/s(s+10), how can the state feedback controller be designed?</p>

答:
Using given transfer function you can get your state space model by control canonical form and you get your A,B,C,D matrix after that you can derive your P gain or feedback control gain by this equation

P=1/(C*(B*K-1)^(-1)*B)

where K = Feedback control gain [-0.5 -0 5]
      and P = Proportional Control Gain (in your case it is K)


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

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

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

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

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

import time
import sys
from threading import Thread
import logging

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

logging.basicConfig(level=logging.ERROR)

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

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

        self._cf = Crazyflie()

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

        self._cf.open_link(link_uri)

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

        print("Connecting to %s" % link_uri)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            time.sleep(0.01)

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

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

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

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

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

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

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

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

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

Any ideas are welcome. Thank you!

答:
tl;dr - You can't control the aircraft's side-to-side motion because you are only modifying "thrust", which controls the up-and-down motion. If you want to control roll and pitch (side-to-side motion), then you need to write to each motor individually. There are other problems, too - read on for more.

In looking at your code, I found a couple points where you might be having issues:

You initialize thrust to 20000, which means you enter the loop in the code. This locks you in the while loop for an indeterminate amount of time. This is because you stay locked in the loop until you can get thrust below 20000. The only way that you can decrement thrust is if you both are at or above max_thrust and you have exceeded your time limit run_time. If you just exceed run_time but you are not at or above max_thrust, then you do not decrement thrust. This is problematic because...

You don't have any bounds checking on thrust. The way your code is currently set up, you check if thrust <= max_thrust, which means that if thrust == max_thrust, you enter the case and proceed to tack on another thrust_step to your current thrust value, putting thrust = max_thrust + thrust_step. From that point on, your thrust is strictly greater than max_thrust and thus you cannot enter that if statement ever again unless your thrust_multiplier is exactly -1. This is an issue where...

Say you detect the the aircraft is tipping and now your thrust_multiplier is negative two. Well, you only modify thrust if your current thrust is <= max_thrust OR your thrust_multiplier == -1. As I state above, your code will wind up with a thrust value of max_thrust + thrust_step and, with thrust_multiplier = -2, you will not enter the statement that modifies thrust again. You will stay "locked out" of that statement until your elapsed time exceeds run_time, at which point thrust_multiplier gets set to -1, which then "unlocks" that if statement and (presumably) allows you to land.

So, these are code issues right now. To summarize, you can exceed max_thrust because you don't have bounds checking on thrust, which then locks you out of being able to modify thrust again until you get thrust_multiplier set to exactly -1, which then only happens when you exceed the time limit.

Now, even if you fix this (add bounds checking to thrust after you modify it!), you are still not likely to get the "hover in place" performance that you're looking for.

To be explicitly clear, I'm assuming you are actually writing thrust correctly. I don't see where thrust is used beyond your modifying the value. I do see that you wrote self._cf.commander.send_setpoint(0, 0, 0, 0); I'm not sure if that's the correct command or if you need to include thrust somewhere in there or not.

Anyways, back to flight - you're not going to get the hover in place functionality you want for several reasons:

Biggest reason is that you appear to only be modifying the total thrust. You check if the x gyro OR the y gyro are reading over 75 and take the same action regardless of which axis is rotating. If you wanted to "correct" the tip, then you need to modify the thrust about the particular axis that is "tipping". SIDE NOTE - You just check if the readings are "over 75" but there aren't any units there. Sub-problem (A) here is that a gyro outputs an angular velocity, not an angle, so you might not even be measuring the angle about that axis, and sub-problem (B) is those units might be degrees or radians. 75 radians is almost 4,300 degrees, or almost 12 revolutions.

The next problem is that you just appear to "land quickly" if you detect a tipping condition. Once you set the thrust_multiplier to -2, there's no way in your loop to ever set it positive again. If you did modify your code to counter-act roll or pitch, you have no way of resetting it once you stabilized (or got close to stabilized).

My advice:

Print the value of thrust to your monitor and verify that it does exceed max_thrust then enforce limit checking that caps thrust at max_thrust.

Verify that thrust is actually being used correctly. Can you hard-code a different value for thrust? Does that actually appear to make the change you expected?

If you want to control roll and pitch, you need to write to the individual motors, not overall thrust.

For roll and pitch control, you'll want something more sophisticated than just incrementing/decrementing the thrust by fixed amounts. Look up some flight controller PID control examples. If this is an open-source quadcopter then there should be a tutorial/manual published for the unit that would show you how to access those control gains.

Even if you can get everything setup to control roll and pitch, your quality of control is really only ever as good as your feedback. If you are using a low-quality IMU then you'll get some pretty significant drift and there really isn't much you can do about it.


问:
Powering a 6v servo and 12v servo
In my project, there are two types of servos ( 6v and 12v supply needs ).
I need to power with the same battery.
How should I go about it?
Use a 6v battery with a step-up voltage regulator?
How does that impact the battery power calculations?
If voltage regulator should be used please recommend one.
Thanks
Ro</p>

答:
Sticking with a 6 volt battery would require you to use something like a boost converter, but the current to the servos would go down as a result. Current lowers in your circuit due to the increase in voltage as the equation P=V*I must be satisfied, where your P (power) is constant.

It will most likely be easier to use a 12 volt battery with a voltage regulatory to step down to 6 volts.

Assuming you wont go over 1.5A on the 6V motor, you can use something like this:

http://www.digikey.com/product-detail/en/micro-commercial-co/MC7806CT-BP/MC7806CT-BPMS-ND/804683

Title: Powering a 6v servo and 12v servo


问:
Problem with angle calculation
I'm using MPU6050(accelerometer+gyro) connected to ATmega328P microcontroller, but probably it isn't even important in my case.

In my project, I need an angle around the X axis. And it's calculated like this:

```<code>angle = -(atan2(acc.XAxis, sqrt(acc.YAxis*acc.YAxis + acc.ZAxis*acc.ZAxis))*180.0)/M_PI;
</code>```

where acc is vector of accelerations in all directions.

The problem is, that it gives me credible value only when angle between Z axis and ground is right (so it's not rotated around Y axis). When I start to rotate it around Y axis it also changes value of X axis rotation.

I know, that it's due to YAxis acceleration in my algorithm, but I have no idea how to get rid of it.

How can I solve this problem?

答:
Your equation is formed so that the angle can be zero only when the projection of the gravity vector onto the X axis is zero.  That gives zero when the system is oriented vertically, because the gravity vector is aligned with the -Y axis.  But you also will get a zero angle result if the gravity vector lies exactly in the Y-Z plane, regardless of the system's angle to the vertical.  That's because there is no projection of the gravity vector into the X direction in that scenario, no matter how you twist the system about the X axis.

If you just want the angle of tilt of your system from the vertical, use:

tilt = acos(-acc.Yaxis)

which will be zero when your system is vertical, and +/- 90 degrees when the system is as far away from vertical as possible.

Angles must always be defined very specifically to match the way you want to use them.  I recommend drawing a diagram and using trigonometry to derive the equations that you use to compute them.  Don't forget that in 3D, multiple angles must always be applied in a specific order, and their values interact within the final result.

Title: Problem with angle calculation


问:
remote controlled quadcopter : Why is it not possible to send all the commands over one channel?
First of all, this might be a stupid or bad question but i am quite new to this topic.

I want to build a rc transmitter (with some joystick buttons, an arduino and a hc-12 transceiver). I've searched a lot about this topic. But i still have a question that rests unanswered.

Why is it necessary to use multiple channnels to control for example pitch,jaw,throttle of a quadcopter. transmitters in shops have 4 or 6 channels but i don't understand why these different channels are necessary. These transmitter send the information of each button over a different channel, why is this necassary?

Is it not possible to send the commands over one channel (all at the same frequency)? For example send p30 for a pitch of 30 degrees and j30 for a jaw of 30 degrees? Than, the receiver can interpret this as well?

I guess it is to send al the commands on the same time?

Thanks in advance

答:
It's a bit more complex than that.

Basically, it is several channels multiplexed and all transmitted on one channel, yet constantly being switched between various channels.

That sounds confusing so let me explain what I mean.

Let's take as an example of a classic four channel RC system. You'd have roll, yaw, pitch and throttle. Each control stick axis is on a separate channel electronically, but then they are multiplexed together into a single channel and the receiver will demultiplex them back out into their various control channels so that each can move a servo or signal a microprocessor.

In the case of a DSM type transmitter this single multiplexed channel is encoded so that a single receiver alone (the one that you bind to) can understand your transmitter. This allows several users to coexist all in the same 2.4GHz band of frequencies. The fact that several users are all transmitting signals to their own vehicles at the same time potentially leads to interference problems and so the transmitter now uses frequency or channel hopping algorithms in order to avoid the interference from all the other users nearby.

So here we have used the word channel to refer to several different things:

several channels, one for each dimension of control

a single multiplexed channel of info transmitted to the receiver

signal hopping between various channels to avoid interference

RC controllers have evolved through many generations and are quite good today at allowing numerous users to coexist in the same area.

Sure, you could design a transmitter that sends all the information you want on a single radio channel as this person seems to have done. But I think that they would soon learn of the shortcomings of their design if they tried to use that one design on multiple vehicles at the same place and time.


问:
How to calculate battery size for servo motors?
I am making a robotic device with the following servo motors.
How do I go about calculating the battery capacity?
It is supposed to run for 10 minutes.
I am bit confused as to use the no-load current or load current or the stall current to add up the amps.

Thanks
Ro

HS-422

HS-485HB

HS-645MG

HS-755HB

HS-805BB

HS-85BB

HS-785HB

答:
This typically requires a bit of testing with your actual payload. You can try to model it mathematically, but it's easier and more accurate to just plug it in and measure the current draw.

Current draw in a motor increases with the amount of torque required. No load current is how much current the servo will draw if you move it with nothing attached to the shaft at all. The stall current is how much it will draw if you clamp the shaft in place (say, with a vice grip) and tell it to move. Keeping that in mind, your real-world current draw will be somewhere in between those two numbers.

A reasonable approximation for an arm like you're building would be to measure the average current for each time you pick up and move your payload and how long that (averaged out) current draw occurs for per motion. If you know how many of those motions per minute you need to do (or more conservatively, are capable of doing), then you can figure out how much power you're going to draw over the course of your 10 minute runtime.


答:
First, can you add as much battery as you wanted? Meaning, is there a technical or score-wise drawback to the amount of battery? Or mass?

Does the servo load increase with the increased battery amount? (Probably not).

The above considerations would require a precise battery sizing. Otherwise, taking a rough estimation and then buying one size bigger and smaller batteries would be the fastest and most pragmatic road to success.

If you do not want to purchase unnecessary items, you can calculate the energy consumption using power utilization as below:

1) divide the total operational time into phases. Like, phase 1. startup and waiting
Phase 2. Competition run
Phase 3. Wait for Xxx
Phase 4. Run-2
Phase 5. Finished and waiting

2) In each of these phases determine the power drawn from the battery, and multiply that with the amount of time of that phase.

3) And when you find the exact number, add 20% for uncertainties. This would help select the required battery.

Notes: 1) temperature is ignored (assume the competition is indoors).
2) validating this method can be done by literally testing it 2-3 times for especially the operational cases (competition runs).

Title: How to calculate battery size for servo motors?

Body:
I am making a robotic device with the following servo motors.
How do I go about calculating the battery capacity?
It is supposed to run for 10 minutes.
I am bit confused as to use the no-load current or load current or the stall current to add up the amps.

Thanks
Ro

HS-422

HS-485HB

HS-645MG

HS-755HB

HS-805BB

HS-85BB

HS-785HB


问:
Does iRobot 681 have a serial interface?
I've read that recent Roomba 6XX from iRobot got a serial connector, but I removed the cover on my Roomba 681, and I haven't found any. From what I've found, 681 hasn't the same cover than other 6XX robots. Does this model have an accesible serial port?

答:
The 68x series has a Mini-DIN connector on the top surface, toward the robot's right side, but it's now under the translucent diffuser surrounding the buttons. It is held in by snaps. Lift the handle, stick your fingers under, and pull the plastic piece up and out.

Please note that I am an iRobot employee, but the postings on this site are my own and don't necessarily represent iRobot's positions, strategies, or opinions.


问:
How to communicate Ardupilot with Arduino
Can anyone tell me if it is possible to send data through the analogue pins of the Ardupilot to the analog pins of the Arduino?
For example, I would like to trigger a button on a channel from my radio control and Ardupilot should send a specific number to the Arduino. Would anyone have any idea how I can do this?
Thank you in advance.</p>

答:
Specific number? no. there will be some inaccuracy.

Also note that your servo output is a period of time at high voltage, then a long gap at ground. So if you just use analogRead then you will only ever get high or low value (seemingly at randomly as your Arduino and ardupilot drift in and out of phase).
You would have to (unless there already exists a library) time the ms the channel stays high for.
Or you could try and smooth this signal with a capacitor and use analogRead as normal (very inaccurate BTW, but could easily determine an on/off signal from a transmitter).

Alternatively, use I2C, this will allow you to send precise data between your 2 devices. But you will have to find out how to instruct your Ardupilot on what to send over the I2C bus.


问:
Lego Mindsotrms RCX 1.0 CPU
I am working on a project and I need to know what is the exact model number of the CPU that is in the Lego Mindstorms RCX 1.0 . It would be nice if you listed the specs of the CPU, beacause I am looking for its MIPS performance.</p>

答:
From wikipedia follows, that it is a 8-bit Renesas/Hitachi H8/300 16 MHz CPU with 32KB RAM.

Source: https://en.wikipedia.org/wiki/Lego_Mindstorms

Title: Lego Mindsotrms RCX 1.0 CPU


答: I would say gyroscopes, they are what is used in every other engineering discipline. However, I have no experience using gyroscopes with robotics. </p>

Title: Self balancing robot control system strategies

Body:
I’m in the early stages of designing a self-balancing robot as a way to refresh my knowledge on control theory, which has been gradually slipping away since graduating about a year and a half ago. I'm wondering if anyone has any input on how best to approach this problem.

My plan is to use a 6 DOF IMU as an angle sensor, and to control the pitch by accelerating and decelerating the cart. I'm looking for robust response to disturbance, and to add in RC differential drive capabilities later on. This block diagram is a pretty close match for what I was planning to do,  (source: Sebastian Nilsson's Blog):

Would this be a good approach? Any recommended alternatives? Thanks.


答: I tried looking it up on wikipedia, but there was only the group of processors listed in the article and not the exact CPU model, so I could not find out its specs, because there are multiple CPU of the kind, mentioned in the wikipedia article.</p>

Title: Lego Mindsotrms RCX 1.0 CPU

Body: I am working on a project and I need to know what is the exact model number of the CPU that is in the Lego Mindstorms RCX 1.0 . It would be nice if you listed the specs of the CPU, beacause I am looking for its MIPS performance.</p>


问:
Cannot launch iRobot Create. Powers down upon minimal launch?
I just got an iRobot iCreate base and I've followed the instructions given in  ROS Tutorials to setup the turtlebot pc and the workstation. I could successfully ssh into username@turtlebot through workstation so I'm assuming that is all good. I had an issue with create not able to detect the usb cable which I solved using the detailed answer given for question here. This solved the problem of "Failed to open port /dev/ttyUSB0" that I was facing before.

Now the next step would be to ssh into the turtlebot (which I've done) and use roslaunch turtlebot_bringup minimal.launch to do whatever the command does (I've no idea what to expect upon launch). But apparently something's amiss since the create base chirps and then powers down after showing [kinect_breaker_enabler-5] process has finished cleanly as output and the log file location (see output below), but I dont see a prompt. I checked the battery and that's charged so that's not the problem. Following is the terminal output.

```<code>anshul@AnshulsPC:~$ roslaunch turtlebot_bringup minimal.launch
... logging to /home/anshul/.ros/log/9d936a6a-fbdc-11e3-ba6b-00265e5f3bb9/roslaunch-AnshulsPC-5038.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.

started roslaunch server http://128.110.74.233:48495/

SUMMARY
========

PARAMETERS
 * /cmd_vel_mux/yaml_cfg_file
 * /diagnostic_aggregator/analyzers/digital_io/path
 * /diagnostic_aggregator/analyzers/digital_io/startswith
 * /diagnostic_aggregator/analyzers/digital_io/timeout
 * /diagnostic_aggregator/analyzers/digital_io/type
 * /diagnostic_aggregator/analyzers/mode/path
 * /diagnostic_aggregator/analyzers/mode/startswith
 * /diagnostic_aggregator/analyzers/mode/timeout
 * /diagnostic_aggregator/analyzers/mode/type
 * /diagnostic_aggregator/analyzers/nodes/contains
 * /diagnostic_aggregator/analyzers/nodes/path
 * /diagnostic_aggregator/analyzers/nodes/timeout
 * /diagnostic_aggregator/analyzers/nodes/type
 * /diagnostic_aggregator/analyzers/power/path
 * /diagnostic_aggregator/analyzers/power/startswith
 * /diagnostic_aggregator/analyzers/power/timeout
 * /diagnostic_aggregator/analyzers/power/type
 * /diagnostic_aggregator/analyzers/sensors/path
 * /diagnostic_aggregator/analyzers/sensors/startswith
 * /diagnostic_aggregator/analyzers/sensors/timeout
 * /diagnostic_aggregator/analyzers/sensors/type
 * /diagnostic_aggregator/base_path
 * /diagnostic_aggregator/pub_rate
 * /robot/name
 * /robot/type
 * /robot_description
 * /robot_pose_ekf/freq
 * /robot_pose_ekf/imu_used
 * /robot_pose_ekf/odom_used
 * /robot_pose_ekf/output_frame
 * /robot_pose_ekf/publish_tf
 * /robot_pose_ekf/sensor_timeout
 * /robot_pose_ekf/vo_used
 * /robot_state_publisher/publish_frequency
 * /rosdistro
 * /rosversion
 * /turtlebot_laptop_battery/acpi_path
 * /turtlebot_node/bonus
 * /turtlebot_node/port
 * /turtlebot_node/update_rate
 * /use_sim_time

NODES
  /
    cmd_vel_mux (nodelet/nodelet)
    diagnostic_aggregator (diagnostic_aggregator/aggregator_node)
    kinect_breaker_enabler (create_node/kinect_breaker_enabler.py)
    mobile_base_nodelet_manager (nodelet/nodelet)
    robot_pose_ekf (robot_pose_ekf/robot_pose_ekf)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    turtlebot_laptop_battery (linux_hardware/laptop_battery.py)
    turtlebot_node (create_node/turtlebot_node.py)

auto-starting new master
process[master]: started with pid [5055]
ROS_MASTER_URI=http://128.110.74.233:11311

setting /run_id to 9d936a6a-fbdc-11e3-ba6b-00265e5f3bb9
process[rosout-1]: started with pid [5068]
started core service [/rosout]
process[robot_state_publisher-2]: started with pid [5081]
process[diagnostic_aggregator-3]: started with pid [5102]
process[turtlebot_node-4]: started with pid [5117]
process[kinect_breaker_enabler-5]: started with pid [5122]
process[robot_pose_ekf-6]: started with pid [5181]
process[mobile_base_nodelet_manager-7]: started with pid [5226]
process[cmd_vel_mux-8]: started with pid [5245]
process[turtlebot_laptop_battery-9]: started with pid [5262]
[WARN] [WallTime: 1403641073.765412] Create : robot not connected yet, sci not available
[WARN] [WallTime: 1403641076.772764] Create : robot not connected yet, sci not available
[kinect_breaker_enabler-5] process has finished cleanly
log file: /home/anshul/.ros/log/9d936a6a-fbdc-11e3-ba6b-00265e5f3bb9/kinect_breaker_enabler-5*.log
</code>```

Following is the log file: /home/anshul/.ros/log/9d936a6a-fbdc-11e3-ba6b-00265e5f3bb9/kinect_breaker_enabler-5*.log output:

```<code>[rospy.client][INFO] 2014-06-24 14:20:12,442: init_node, name[/kinect_breaker_enabler], pid[5538]
[xmlrpc][INFO] 2014-06-24 14:20:12,442: XML-RPC server binding to 0.0.0.0:0
[rospy.init][INFO] 2014-06-24 14:20:12,443: ROS Slave URI: [http://128.110.74.233:51362/]
[xmlrpc][INFO] 2014-06-24 14:20:12,443: Started XML-RPC server [http://128.110.74.233:51362/]
[rospy.impl.masterslave][INFO] 2014-06-24 14:20:12,443: _ready: http://128.110.74.233:51362/
[xmlrpc][INFO] 2014-06-24 14:20:12,444: xml rpc node: starting XML-RPC server
[rospy.registration][INFO] 2014-06-24 14:20:12,445: Registering with master node http://128.110.74.233:11311
[rospy.init][INFO] 2014-06-24 14:20:12,543: registered with master
[rospy.rosout][INFO] 2014-06-24 14:20:12,544: initializing /rosout core topic
[rospy.rosout][INFO] 2014-06-24 14:20:12,546: connected to core topic /rosout
[rospy.simtime][INFO] 2014-06-24 14:20:12,547: /use_sim_time is not set, will not subscribe to simulated time [/clock] topic
[rospy.internal][INFO] 2014-06-24 14:20:12,820: topic[/rosout] adding connection to [/rosout], count 0
[rospy.core][INFO] 2014-06-24 14:20:20,182: signal_shutdown [atexit]
[rospy.internal][INFO] 2014-06-24 14:20:20,187: topic[/rosout] removing connection to /rosout
[rospy.impl.masterslave][INFO] 2014-06-24 14:20:20,188: atexit
</code>```

From the logs, I could tell something told the create to power down. And since the log is named with 'kinect', I tried minimal.launch w/ and w/o kinect attached to the turtlebot pc. It doesn't make any difference.

Any clue what I might be missing? Or is this the way bringup works (I guess not)?

答:
To help people who may find this answer later, it's worth knowing that iRobot just published a guide to connect the Create 2 to ROS and a PrimeSensor; it can be found at http://www.irobotweb.com/~/media/MainSite/PDFs/About/STEM/Create/Create2_PrimeSense.pdf .

 Please note that I am an iRobot employee, but the postings on this site are my own and don't necessarily represent iRobot's positions, strategies, or opinions.


答:
Arduino, HC-12 transceivers and a KY-023-type X and Y Joystick?
I shall be able to respond it to you in a few days time.
I got my remote control already working, a 50k Potentiometer to send to the ESC on the plane the motor speed that I desire and the KY-023. I am using an Arduino Nano (Micro or Uno would work great as well), however, on the receiver side(plane), I am using an Arduino based on Atmega32u4, a little more expensive. Why? For better performance, and in order to avoid interference with the servos, so you need a physical serial UART port, and the other Arduinos(with the exception of the 32u4-based and the Mega) have only one, witch is used to upload the code and debug (the Serial instance). This one has Serial and Serial1, Serial1 being represented by a pair of distinct pins on the board, that provides you with a hardware-based serial UART interface (avoiding running the HC-12 over a software-based one) that will give you better IO performance and also avoid conflicts with the Servo.h lib that uses Timer1. The only reason that I can't give you the answer now, is that I burned my receiver by accident while connecting it to a drop-down voltage regulator in order to start outdoor testing. Indoors it was moving the servos with quite acceptable delay, however, due to current limitations I had to buy those external power supplies, coz the onboard ones were not holding voltage while dealing with 2 servos plus the transceiver. I was using factory default configuration, Serial1 set to 9600bps. Data format is: 1000,110,89 -> First value meant to be ESC speed control, second one to be X servo position and third to be Y servo position. The manual(datasheet) says it has a time between 4-80mS per byte sent, so, do not abuse it. I also read that if you send and receive too much data at the same time, it gets as slow as 1 sec. per cycle. So this is it! As soon as I get a new board I will start outdoor testing and post the results.</p>

Title: remote controlled quadcopter : Why is it not possible to send all the commands over one channel?

Body:
First of all, this might be a stupid or bad question but i am quite new to this topic.

I want to build a rc transmitter (with some joystick buttons, an arduino and a hc-12 transceiver). I've searched a lot about this topic. But i still have a question that rests unanswered.

Why is it necessary to use multiple channnels to control for example pitch,jaw,throttle of a quadcopter. transmitters in shops have 4 or 6 channels but i don't understand why these different channels are necessary. These transmitter send the information of each button over a different channel, why is this necassary?

Is it not possible to send the commands over one channel (all at the same frequency)? For example send p30 for a pitch of 30 degrees and j30 for a jaw of 30 degrees? Than, the receiver can interpret this as well?

I guess it is to send al the commands on the same time?

Thanks in advance


问:
How to use SLAM with simple sensors
What 2D SLAM implementations (preferably included in ROS) can be used with simple distance sensors like IR or ultrasonic rangefinders?

I have a small mobile platform equipped with three forward facing ultrasonic sensors (positioned at 45 degrees, straight ahead, and -45 degrees), as well as a 6-DOF accel/gryo and wheel encoders, and I'd like to use this to play around with a "toy" SLAM implementation. I don't want to waste money on a Kinect, much less a commercial laser rangefinder, so methods that require high-density laser measurements aren't applicable.

答:
Use single ultrassonic sensor with DOF mechanism & try use arduino board,
create a node for gmapping use ultrasonic simple arduino code swap the variable in gmapping node code. Once you get distance it would easy for you to publish these variable of a network you can use as you want.

The most difficult task is swapping variable in arduino code. You must use your programming skills for swapping these variable.

One thing I'm not sure about rate of "distance variable", it would be sufficient or not for gmaaping. Maybe by using laser sensor rate of distance variable is higher.

Title: How to use SLAM with simple sensors


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

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

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

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

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

答:
In chemistry, you will learn the composition of matter there they have thought you about properties of certain metals/non-metals. They have certain limits, such as melting point/freezing point.

Temperature does matter in electronics. When you overclock your computer, you need liquid nitrogen to cool down your chip. Same is true for any other device.

The electronics that go into space does not only face this problem but also they must be cautious about radiations which can corrupt data. Thus, usually rovers carry additional chips/batteries for backup. The data they collect there is of great importance.

Title: Why do space probes need heating?


问:
I-Robot Create 2 reset after sleep issue?
I am having issues with bringing the robot out of its sleep or off mode. Seems it goes into sleep mode when there is no activity for about 4 minutes. I am using the i-Robot Create 2 serial cable. When it is in its sleep mode I try removing the cable end plugged into robot and connect jumper wire between pins 5 and 6 on the robot 7 pin connector for a brief time period. This effectively shorts the BRC pin to GND for a short period of time ( less than 1 second). Then I reconnect the serial port cable into the robot 7 pin connector and try giving the robot a command but no go. I have also read that commands 173 and 173 173 can help with this issue but I may be mistaken. Any help on this is very much appreciated !!!! Rick</p>

答: I suspect you may have a bad cable. Have you verified that the pin is changing level on the end of the Mini-DIN (with a voltmeter)? If it is not, and you are using an iRobot cable, contact create@irobot.com referencing this post.</p>


问:
Public dataset for monocular visual odometry
I am planning to develop a monocular visual odometry system. Is there any indoor dataset available to the public, along with the ground truth, on which I can test my approach?

Note: I am already aware of the KITTI Vision Benchmark Suite which provides stereo data for outdoor vehicles.

If anyone has access to the datasets used in the following paper [SVO14], it would be even more great: http://rpg.ifi.uzh.ch/docs/ICRA14_Forster.pdf

答:
This is another more recent one, based on the paper A Photometrically Calibrated Benchmark For Monocular Visual Odometry by Engel et al:

http://vision.in.tum.de/data/datasets/mono-dataset

This gives both indoor and outdoor scenes, with calibration (or the corresponding sequences so you can calibrate yourself). I haven't tested it fully myself but it seems a rather complete dataset.


问:
Locate a quadcopter in x,y space
I have a quadcopter using image processing to detect shapes on the ground to the determine x,y position. It works ok. My problem is that if the illumination isnt perfect.

I would like to know if there's a way to fuse the image processing data with another kind of way to find the position x,y of the quadcopter.

My teacher told me about Bluetooth Low Energy and some beacons but I dont think it will work.

答:
There are a number of things you can do, the first is it seams that you have the opportunity to increase your computer vision systems effectiveness, I am unsure what you are doing now but off the top of my head:

Do your work in the HSV space instead of the RGB space it generally gives better results becouse it splits the actual color from the brightness or hue

Use easier to identify glyphs, tune the sizes and types to suit your environment, generally if your lighting is going to be consistent you can use colored glyphs which can allow you to make them smaller, or if you have widely variable lighting conditions you can use black and white glyphs, which will reduce your information density somewhat.

But if you want to use another localization method as well, you can use one of the simple radio location methods, that uses BLE or Wifi, which generally will integrate all the bluetooth (or wifi) stations within range calculating the round trip time to them, as well as the received power in dB, they can then use the predetermined station locations and the approximate distances in order to calculate a xy, or xyz location. Generally in practice the location accuracy can be very poor, around 10-20ft.

Another location technology that can give better readings is a Ultra Wideband system like Pozyx based on the Decawave system (which has some Open Source Libraries available). These can give you an accuracy better than 10 cm but can get pretty expensive depending on the area you need to cover.

Finally for indoor robotics research there is the 8,000lb gorilla, the Motion Capture Systems like Vicon, and Qualisys. These systems can run $50K or more, but can give you amazing volumes of information like 1cm accuracy at 100 or 500 Hz depending on your setup.

This all assumes your inside, if your outside you might want to check out systems like RTK GPS, and DGPS. both can give you sub 10cm locations.

You can take all the information you get from sources like this, along with your vehicle's Gyroscope, Accelerometer and Magnetometer, and throw it into a Kalman Filter in order to get the best possible location estimate.

Title: Locate a quadcopter in x,y space


答:
http://vision.in.tum.de/data/datasets/rgbd-dataset

This is a set of recordings for the Kinect and Asus Xtion pro, which are all indoors (in offices and a hangar). It comes with precise ground truth from a motion capturing system.

The data is available as ROS bag files, but also as a tarball with png images with a text file for the trajectory.

There are also some scripts to benchmark your results against the ground truth.

Title: Public dataset for monocular visual odometry

Body:
I am planning to develop a monocular visual odometry system. Is there any indoor dataset available to the public, along with the ground truth, on which I can test my approach?

Note: I am already aware of the KITTI Vision Benchmark Suite which provides stereo data for outdoor vehicles.

If anyone has access to the datasets used in the following paper [SVO14], it would be even more great: http://rpg.ifi.uzh.ch/docs/ICRA14_Forster.pdf


问:
Low power computer for stereo vision
I would like to build a motorized robot with stereo vision that sends visual input to a PC over wifi for processing. A Raspberry Pi would have been perfect for the task if it would be possible to connect 2 cameras. The Pi 2 would be powerful enough for two USB webcams (with minimum 8fps) I guess, but the shared USB seems to be a bottleneck (2 cameras + wifi dongle).

What other options are there to send input from 2 cameras and control a motor (or an arduino)?

答:
Not sure how well this will run on a Raspberry Pi but the Zed stereo camera does most of the processing istelf with makes it ideal for this type of thing.

https://www.stereolabs.com/

Title: Low power computer for stereo vision


问:
How do I determine the required encoder resolution for a control system?
I'm designing a joint which will have to move with a velocity of ~60RPM and I have to come up with resolution requirement for the encoders within this joint. I notice however that this is easier said than done.

A 1m beam will be connected to the joint, I figured I would need to know the position of the tip of the beam with a resolution of approximately 1mm. with some simple calculations I found that for this a 12-bit encoder will be sufficient.

However, I was wondering whether this would be sufficient to actually control the joint in a smooth manner. I found some information about how the resolution influences the joint behavior but didn't find anything about how to use this to find resolution requirements. For example I found:

"When you tune the constants right, you should be able to run your arm
  at a constant speed. However, this is dependent that you have a fairly
  high-resolution encoder,"

I have no idea what a "fairly high-resolution encoder" is. I was wondering if any of you have any experience with this or know any methods to determine the required resolution.

答:
First I would question your math that got you to the 12b sensor.

If you have a $dy$ of 1 mm over an arm that is $r = 1$ m long, then $\sin(\theta) = dy/r \rightarrow \theta = \mbox{asin}(dy/r)$. If you make the small angle approximation $\sin{\theta} \approx \theta$, then $\theta \approx dy/r$.

This is $\theta$ in radians, so you're looking at a full circle (complete revolution) of 2$\pi$. In order to resolve $\theta$, you need a "segment" of the circle to be at most the size of $\theta$.

If $\theta \approx dy/r$, then $\theta \approx 0.001/1 = 0.001$. For a full revolution of $2\pi \approx 6.283$, you're going to need there to be $(6.283/0.001)$ "segments" in the revolution, or 6,283.

A 12 bit sensor has a range of [0,(2^12)-1], or [0,4095]. This means that you only get 4096 segments of the revolution, and each segment spans an arc of 0.0015 radians. This corresponds to about (again, small angle approximation) a $dy \approx 1.5$mm.

So you need to bump the sensor resolution by at least double, to a 13b sensor. This gets you 2^13 segments, 8,192, putting your smallest measurable $dy$ around 0.77 mm.

If you're looking to control to that degree of precision, you need to be sure that your signal doesn't get lost in the noise. Typically a datasheet will give a specification to accuracy and/or noise in terms of the least significant bit. Generally this would be something like +/- 3 LSB or +/- 5 LSB, etc.

So, in this case, with a 13b sensor, the least significant bit represents 0.77 mm in your system, so you're trying to control to +/- 1mm but your noise, at +/- 3 LSB, is actually +/- 2.3 mm, so that's not possible.

Increase the resolution to 14b to half the LSB, and then your +/- 3 LSB becomes half of the +/- 2.3 mm, or about +/- 1.15 mm. So, maybe then that's still not reasonable for you. I don't recall seeing 15b sensors even though 13b seems to be relatively common. That means you'd probably go on up to a 16b sensor. This puts the LSB at one fourth the value of the 14b sensor, or one fourth of +/- 1.15 mm. Now you're looking at noise of just under +/- 0.3mm. This is probably the sensor you would want to use.

Now you'll also see why industrial controls, unlike academic controls, generally don't use a derivative (D) term in the PID controller. Industrial controls are generally just PI controllers because the derivative term is so sensitive to noise. In the example above, you could very realistically get a swing from -3 LSB to +3 LSB, or -0.3mm to +0.3mm, in one sample period, and that's IF the system being measured doesn't move. At a relatively low sample rate of 25Hz, 0.6 mm/0.04 s = 15 mm/s, or a "phantom" speed of over half an inch per second. This signal goes up the faster your sample time is, leading to very large incorrect readings.

So, tl;dr - pick a sensor that gets the signal on par with what you're trying to control. Sensors all have noise and choosing the sensor that barely meets your requirements is not the right way to do it.


问:
Balance Bot PID tuning
so I am working on a Self Balancing Bot with Arduino Mega. I'm using 12V 200 RPM motors with built in 840 PPR quadrature encoders. The torque rating is as follows:

Rated Torque: 2.4 Kg-cm
Stall Torque: 6 Kg-cm

As of now I've implemented a simple PID controller (based on Brett Beauregard's PID library) to minimize only the tilt angle error. Still haven't implemented PID using the encoder for the position error.

I've tried a lot to tune the PID values. The robot is quite stable when it is standing its own. However, here's the issue, when the robot tilts by an angle greater than 7-8 degrees (or when it is pushed slightly) from its stable position, the motors start rotating at the maximum speed (PWM: 255) and the robot still doesn't seem to recover back and just keeps running and then finally falls down in the direction in which it was moving. It doesn't seem to recover at all.

Is it just a problem with the PID tuning? As I said earlier, it's stable for the range -5 to +5 degrees (0 degrees is the upright position) without oscillating much. However it is not able to recover for errors greater than 7 degrees.

Or could this be an issue with the robot being too heavy and insufficient counter motor torque? Total weight of the robot is around 1 kg (including the motors). I'm using 2200 mAh LiPo battery and have placed it at the highest level so as to decrease the angular acceleration.

Would implementing the PID feedback for encoders as well solve this issue? Also do suggest some links on how to implement dual PID using an IMU and encoders to correct tilt angle and position. I'm planning to use cascaded PID controllers in which the encoder PID measures the error in position and its output will be the set-point for the angle PID loop which in turn will control the PWM of the motors. So if there's an offset in position the angle set-point will change to, let say -2 degrees (from upright 0 degrees). So now the angle PID will make the robot move in order to correct the angle offset and therefore the position error also gets corrected. Is this a good method. Any other suggestions or different approaches to this?

答:
Just a hint from my extensive experience from self balancing robots:

The most important aspect of a self balancing robot, is the actuator acceleration (torque) control.

(...) the motors start rotating at the maximum speed (PWM: 255) and the robot still doesn't seem to recover back and just keeps running and then finally falls down in the direction in which it was moving. It doesn't seem to recover at all.

Because to balance, the robot needs shifts in velocity, i.e. acceleration (produced by motor torque). If your motor saturates, the control cannot execute the balancing action: accelerate to shift the center of mass.

Furthermore, the relationship between the tilt angle, and the required motor acceleration is not linear. i.e. to recover from 5 deg may require 0.1 N.m from the motors, and to recover from 7 deg may require 1.0 N.m.

Would implementing the PID feedback for encoders as well solve this issue?

You definitely should have PID for motor control. How do you make sure the motors are performing the velocity/torque that the balancing PID requested?

I'm planning to use cascaded PID controllers in which the encoder PID measures the error in position and its output will be the set-point for the angle PID loop which in turn will control the PWM of the motors.

Yest, looks good! See similar question: Self balancing robot control system strategies

Title: Balance Bot PID tuning


答:
I would put forward three main points for the temperature sensitivity of electronics, electronic components and mechanical parts:

All batteries are quite sensitive when it comes to temperature. Chemical reaction rates are reduced, and leakage current is increased.

Silicon chips usually don't have a problem with low temperatures. What does is the packaging and the PCB substrates and bonds. And even here the actual problem is not the low temperature, but the temperature range. The reason for this is that the materials have different thermal properties, like thermal conductivity and expansion. The packaged chips as well as the bonds with the PCB will generate mechanical stress which increases the chances of micro-fractures in the conductive materials.

Moving mechanical parts like motors and gears often need lubricants to work. The mechanical properties of those lubricants are very temperature sensitive.

As far as I know the lowest you can go with primary batteries is something like -50C. Secondaries are even worse. So there is really no other option than to insulate and heat. The electronics you can make work at low temperatures, by using PCB materials which have a similar expansion to silicon, and directly mount the silicon chips onto the substrate without the classical chip packaging.

Title: Why do space probes need heating?

Body:
I know that temperature influences the characteristics of semiconductors and other materials, but we know how and can take that into account. Furthermore, lower temperatures makes electronics more efficient, sometimes even superconducting.

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

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

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

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


问:
Roslaunch include file remotely
I am trying to launch a file from remote computer but I could not success. Actually I can connect to remote computer but I think the problem is with including a file from remote computer. In other words, I am looking for a machine tag for include. Here is the my code:</p>

```<code><launch>

    <group >
      <machine name="marvin-1" address="tek-marvin-1" user="blabla" password="blabla" env-loader="/home/blabla/.rosLaunchScript.sh"/>

      <include file="$(find openni_launch_marvin)/launch/kinect_left.launch"/>
    </group>

</launch>
</code>```

答:
A better approach would be to first ssh into the remote computer. In the remote terminal, run

```<code>export MASTER_URI = http://IP_address_master:Port_number
</code>```

where IP_address_master should be the IP address of the computer on which you want to run the master node. IP address could either be of your local machine or remote computer. Port_number is the port of your master node (generally it is 11311). On the same terminal, run

```<code>export ROS_IP = IP_address_remote
</code>```

where IP_address_remote is the IP of your remote computer.
In the terminal of your local machine (not the one where you are running ssh from), run the following commands:

```<code>export MASTER_URI = http://IP_address_master:Port_number
export ROS_IP = IP_address_local
</code>```

where, IP_address_master and Port_number is same as above but IP_address_local should be the IP address of your local computer.

Now, you are ready to launch the file from your remote terminal. Your no longer require a separate launch file. In the ssh terminal, run the launch file kinect_left.launch directly as:

```<code>roslaunch openni_launch_marvin kinect_left.launch
</code>```

Title: Roslaunch include file remotely

Body:
A better approach would be to first ssh into the remote computer. In the remote terminal, run

export MASTER_URI = http://IP_address_master:Port_number

where IP_address_master should be the IP address of the computer on which you want to run the master node. IP address could either be of your local machine or remote computer. Port_number is the port of your master node (generally it is 11311). On the same terminal, run

export ROS_IP = IP_address_remote

where IP_address_remote is the IP of your remote computer.
In the terminal of your local machine (not the one where you are running ssh from), run the following commands:

export MASTER_URI = http://IP_address_master:Port_number
export ROS_IP = IP_address_local

where, IP_address_master and Port_number is same as above but IP_address_local should be the IP address of your local computer.

Now, you are ready to launch the file from your remote terminal. Your no longer require a separate launch file. In the ssh terminal, run the launch file kinect_left.launch directly as:

roslaunch openni_launch_marvin kinect_left.launch


答:
One factor in this that hasn't been mentioned in the other questions is that different materials change their volumes in different ways in response to temperature fluctuations.  This is the concept behind bimetallic strips in thermostats, why pipes burst when frozen, and why your food gets "freezer burned".  So, although semiconductors may be fairly resilient to cold temperatures, mechanical parts with a variety of materials (different alloys, different lubricants) will be less so.

To have a mechanical part that works at an extreme temperature (like -100C), presumably it would need to be fabricated at that temperature, integrated into the main component at that temperature, and kept cold until it reached space.

Title: Why do space probes need heating?


问:
What are the prerequisites for learning ROS?
It is helpful in robotics to first learn about "Linux kernel development" or "device driver development in Linux" before I start learning ROS? I know C and JAVA! In brief, I want to know any prerequisites which are essential to understand ROS better.</p>

答: You do not require "Linux kernel development" or "device driver development in Linux" before starting ROS. As ROS allows you to write programs in either C++ or python, familiarity with these two languages would be helpful. As you are familiar with C, learning C++ may not be that difficult. In addition to that, familiarity using linux terminal would be beneficial. However, even if you are not comfortable with linux terminal, you can start learning ROS. In that case, first start following the ROS tutorials step-by-step and if you are not familiar with commands mentioned in the tutorials you can always search what actions those commands perform. I would suggest you to start the ROS tutorials and always learn the dependencies on the go.</p>