Tuesday, April 16, 2013

Conversion Troubles

I have made some progress since last time I posted. I have now create an algorithm that can calculate the local side reel time. This will allow me to figure out where the equatorial coordinate system is currently located, and it will let me track objects with precision. The psudocode for this is made of these three functions:


public float getJulianDate(Date date){
    //calc julain date at 00:00:00 GMT on input date
    month = date.getMonth();
    year = date.getYear();
    day = date.getday();
   
    tempA = int(year/100);
    tempB = 2-tempA+int(tempA/4);
    tempC = int(365.25*year);
    tempE = int(30.6001*(month+1));
   
    return tempB + tempC+ tempE + day + 1720994.5;
}

public float getGST(Date date, Time gtime){
    float jdate = getJuLianDate(date);
    temp = (jdate - 2451545.0)/36525.0;
    temp0 = 6.697374558+ (2400.051336*temp)+(0.000025862*(T^2))+(gtime*1.0027379093);
    while(temp0>24 || temp0<0){
        if(temp0>24)
            temp0 = temp0 - 24;
        else if(temp0<0)
            temp0 = temp0 + 24;
    }
    return temp0;
}

public float getLST(Float longitude, Time ltime, Time utime, Date date){
    float gst = getGST(date, utime);
    Float lst = gst + (longitude/15);
    if(lst<0){
        while(lst<0)
            lst= lst+24;
    }
    else{
        while(lst>24)
            lst = lst-24;
    }
    return lst;
}

Right now, I am trying to figure out the next step. That is reading the Euler angles from my ArduIMU and converting them to a position on the equatorial coordinate system. This is proving to be complicate since the coordinate system literally changes with each passing second. I'm hoping to maybe just calculate this every couple of minutes to check for accuracy and somehow write an algorithm that will follow the movement of the coordinate system between the checks.

I am about half way through figure out the conversion. I believe the yaw is equal to declination and the roll is equal to the right ascension. This make working with declination really simply. I can basically treat it as the radius in a set of polar coordinates. The only problem is instead of starting at 0 it will start at 90 and decrease. Even as it crosses the the celestial equator, I believe this method should work. The right ascension will be a little more tricky since it will be constantly changing. So far this is what I have come up with for it. First I will have to convert hours to degrees (shouldn't be hard, 360/about24=about 15 degrees). At this point, I'm having a little trouble wrapping my head around what I should do next. Obviously local side reel time comes into play since it tells where the coordinate system is at the moment. I think I'm going to have to go and play around with the ArduIMU to better understand what the yaw angle is actually telling me and how it relates to right ascension. If you have any suggestions, feel free to jump in.

No comments:

Post a Comment