Friday, October 25, 2013

Counting Sort Uva Example

For counting sort we assume that the numbers are in the range [0,k]. We set up a counter array which counts how many duplicates inside the input , and then reorder the output accordingly without any comparison at all.
Complexity O(n+k).

UVA problem:Age Sorting

Solution:

#include<iostream>
#include<stdio.h>

using namespace std;

int main(){

unsigned long long N,i,printnum;
int age,np[102];
while((scanf("%llu",&N))&&N){
    for(i=0;i<=100;i++){
        np[i]=0;
    }
    for(i=0;i<N;i++){
        cin>>age;
        np[age]++;
    }
    printnum=0;
    for(i=0;i<=100;i++){
    if(np[i]>0){
        for(int j=1;j<=np[i];j++){
            printf("%llu",i);
            printnum++;
            if(printnum<N) printf(" ");
        }

    }
    }
    printf("\n");

}
return 0;
}

Saturday, July 27, 2013

Robot Actuators



 An actuator is a mechanism for activating process control equipment by use of pneumatic, hydraulic, or electronic signals. There are several types of actuators in robotic arms.


Types:
A hydraulic actuator consist of a cylinder or fluid motor that uses hydraulic power to facilitate mechanical operation. The mechanical motion gives an output in terms of linear, rotary or oscillatory motion. Because liquid cannot be compressed, a hydraulic actuator can exert considerable force, but is limited in acceleration and speed.
A pneumatic actuator converts energy formed by compressed air at high pressure into either linear or rotary motion. Pneumatic energy is desirable for main engine controls because it can quickly respond in starting and stopping as the power source does not need to be stored in reserve for operation.
An electric actuator is powered by motor that converts electrical energy to mechanical torque. The electrical energy is used to actuate equipment such as multi-turn valves. It one of the cleanest and most readily available forms of actuator because it does not involve oil.
A mechanical actuator functions by converting rotary motion into linear motion to execute movement. It involves gears, rails, pulleys, chains and other devices to operate.

Examples of Rotating Actuators : 

1. DC Motor
2.DC geared motor
3.Servo motor
4.Stepper Motor
5.BLDC motor
6. AC Servo Motors



Examples of Linear Actuators :

1. Solenoid
2. Linear Servo Motors
3.Linear Stepper Motors








You can convert linear motion into rotating motion or rotation motion into linear motion in many different ways.