Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

Motion reproduction with gyro sensors.

Based on DMP's Vortex processor / SoC this board is a full computer capable of running a standard Windows and Linux installation on the backpack of your robot.
7 postsPage 1 of 1
7 postsPage 1 of 1

Motion reproduction with gyro sensors.

Post by veltrop » Tue Aug 11, 2009 4:35 am

Post by veltrop
Tue Aug 11, 2009 4:35 am

I have a KHR1-HV and I'm thinking of getting a Roboard.

It's nice that the Roboard has a format for replaying motion routines, and it looks like people have been able to convert their H2H motion into the RoBoIO format.

One problem: what about mixing the gyro sensors into realtime movement?

I looked over the RoBoIO source and there doesn't seem to be any handling of any sensor data in the motion reproduction routines.

So, does the motion routine format of RoBoIO include sensor mixing or not?
And, outside of the motion replaying, does the RoBoIO library have anything in it to handle continuous mixing of sensor input to servo position.

Of course I could implement the latter myself easily enough, but as far as I can tell, as soon as I call the RoBoIO motion reproduction functions, the servos will move statically. If I don't have to, I'd rather not spend time modifying their library and then maintaining that modification with their updates.

What have you guys done?
I have a KHR1-HV and I'm thinking of getting a Roboard.

It's nice that the Roboard has a format for replaying motion routines, and it looks like people have been able to convert their H2H motion into the RoBoIO format.

One problem: what about mixing the gyro sensors into realtime movement?

I looked over the RoBoIO source and there doesn't seem to be any handling of any sensor data in the motion reproduction routines.

So, does the motion routine format of RoBoIO include sensor mixing or not?
And, outside of the motion replaying, does the RoBoIO library have anything in it to handle continuous mixing of sensor input to servo position.

Of course I could implement the latter myself easily enough, but as far as I can tell, as soon as I call the RoBoIO motion reproduction functions, the servos will move statically. If I don't have to, I'd rather not spend time modifying their library and then maintaining that modification with their updates.

What have you guys done?
veltrop
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 59
Joined: Wed Jul 22, 2009 8:04 am
Location: Japan

Re: Motion reproduction with gyro sensors.

Post by roboard » Thu Aug 13, 2009 2:40 am

Post by roboard
Thu Aug 13, 2009 2:40 am

veltrop wrote:One problem: what about mixing the gyro sensors into realtime movement?


In RC servo lib of RoBoIO library, a motion of a (KONDO/HiTec) robot is represented as an unsigned long array of 32 elements, in which the i-th element corresponds to the RC servo motor at the i-th (S_i+1) PWM channel.

The value of the i-th element is actually the duty length (in micro-second) of PWM pulses sent to servo motors, and so you can change these values to mix feedback from gyro sensors.

For continuous mixing, you can set a smaller time interval to get fine control when calling rcservo_SetAction(), and mix the sensor input at every rcservo_SetAction() call.
veltrop wrote:One problem: what about mixing the gyro sensors into realtime movement?


In RC servo lib of RoBoIO library, a motion of a (KONDO/HiTec) robot is represented as an unsigned long array of 32 elements, in which the i-th element corresponds to the RC servo motor at the i-th (S_i+1) PWM channel.

The value of the i-th element is actually the duty length (in micro-second) of PWM pulses sent to servo motors, and so you can change these values to mix feedback from gyro sensors.

For continuous mixing, you can set a smaller time interval to get fine control when calling rcservo_SetAction(), and mix the sensor input at every rcservo_SetAction() call.
roboard
Savvy Roboteer
Savvy Roboteer
Posts: 302
Joined: Fri Jul 03, 2009 4:44 am

Post by veltrop » Fri Aug 14, 2009 6:42 am

Post by veltrop
Fri Aug 14, 2009 6:42 am

Thank you very much for pointing me in the right direction! I checked out the source, and your solution should work great when I can use a small time interval.

But if I decide to declare a very long playtime in rcservo_SetAction() (for a motion that requires slow movement) then the sensor data will become outdated before the motion is complete.
I think for truly continuous mixing, the midaction variable of rcservo_PlayAction() could be modified by sensor data.

Thanks again for your help! My question is solved!
Thank you very much for pointing me in the right direction! I checked out the source, and your solution should work great when I can use a small time interval.

But if I decide to declare a very long playtime in rcservo_SetAction() (for a motion that requires slow movement) then the sensor data will become outdated before the motion is complete.
I think for truly continuous mixing, the midaction variable of rcservo_PlayAction() could be modified by sensor data.

Thanks again for your help! My question is solved!
veltrop
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 59
Joined: Wed Jul 22, 2009 8:04 am
Location: Japan

Post by ries » Sun Aug 16, 2009 8:29 am

Post by ries
Sun Aug 16, 2009 8:29 am

continuous mixing would be a very nice feature.
You can set the A/D channel where the gyro's are located and a table which servo's should be mixed with what multiply value.
The servo output functions should then be able to mix the gyro values with each servo output value.

When having long playtimes this could be an important feature.

Hope to see this feature implemented :)

Greetings,
continuous mixing would be a very nice feature.
You can set the A/D channel where the gyro's are located and a table which servo's should be mixed with what multiply value.
The servo output functions should then be able to mix the gyro values with each servo output value.

When having long playtimes this could be an important feature.

Hope to see this feature implemented :)

Greetings,
ries
Savvy Roboteer
Savvy Roboteer
Posts: 62
Joined: Sun Dec 16, 2007 11:33 am
Location: Netherlands

Post by roboard » Mon Aug 17, 2009 12:56 pm

Post by roboard
Mon Aug 17, 2009 12:56 pm

veltrop wrote:But if I decide to declare a very long playtime in rcservo_SetAction() (for a motion that requires slow movement) then the sensor data will become outdated before the motion is complete.
I think for truly continuous mixing, the midaction variable of rcservo_PlayAction() could be modified by sensor data.


Modifying rcservo_PlayAction() to support sensor mixing is easy. Add

Code: Select all
RBAPI(int) rcservo_PlayAction_Mix(unsigned long* mix);


to RCSERVO.H, and add

Code: Select all
RBAPI(int) rcservo_PlayAction_Mix(unsigned long* mix) {
    unsigned long nowtime, t, tt;
    unsigned long midaction[32];
    int i;

    if (RCSERVO_playState != RCSERVO_PLAYING) return RCSERVO_playState;

    nowtime = timer_nowtime();
    if (nowtime >= RCSERVO_curaction_endtime)
    {
        for (i=0; i<32; i++)
            midaction[i] = ((mix == NULL)? 0L : mix[i]) + RCSERVO_curaction[i];

        set_playmode_pulses(midaction);
        RCSERVO_playState = RCSERVO_PLAYEND;
    }
    else
    if (nowtime >= RCSERVO_curaction_nexttime)
    {
        t  = nowtime - RCSERVO_curaction_starttime;
        tt = RCSERVO_curaction_endtime - RCSERVO_curaction_starttime;

        for (i=0; i<32; i++)
        {
            if ((RCSERVO_validChannels & (1L<<i)) == 0L) continue;
            midaction[i] = ((mix == NULL)? 0L : mix[i]) +
                interpolate(RCSERVO_lastaction[i], RCSERVO_curaction[i], tt, t);
        }
        set_playmode_pulses(midaction);

        while (RCSERVO_curaction_nexttime <= nowtime)
            RCSERVO_curaction_nexttime = RCSERVO_curaction_nexttime + RCSERVO_playInterval;
    }

    return RCSERVO_playState;
}


to RCSERVO.CPP; recompile the RoBoIO library and then you get a function rcservo_PlayAction_Mix() to support sensor mixing. This function receives an unsigned long array of 32 elements as input and add the array to the output action when updating PWM duty.

Please try it and report whether it is useful. If it is really useful, we will consider to add it into the next version of RoBoIO library. :)
veltrop wrote:But if I decide to declare a very long playtime in rcservo_SetAction() (for a motion that requires slow movement) then the sensor data will become outdated before the motion is complete.
I think for truly continuous mixing, the midaction variable of rcservo_PlayAction() could be modified by sensor data.


Modifying rcservo_PlayAction() to support sensor mixing is easy. Add

Code: Select all
RBAPI(int) rcservo_PlayAction_Mix(unsigned long* mix);


to RCSERVO.H, and add

Code: Select all
RBAPI(int) rcservo_PlayAction_Mix(unsigned long* mix) {
    unsigned long nowtime, t, tt;
    unsigned long midaction[32];
    int i;

    if (RCSERVO_playState != RCSERVO_PLAYING) return RCSERVO_playState;

    nowtime = timer_nowtime();
    if (nowtime >= RCSERVO_curaction_endtime)
    {
        for (i=0; i<32; i++)
            midaction[i] = ((mix == NULL)? 0L : mix[i]) + RCSERVO_curaction[i];

        set_playmode_pulses(midaction);
        RCSERVO_playState = RCSERVO_PLAYEND;
    }
    else
    if (nowtime >= RCSERVO_curaction_nexttime)
    {
        t  = nowtime - RCSERVO_curaction_starttime;
        tt = RCSERVO_curaction_endtime - RCSERVO_curaction_starttime;

        for (i=0; i<32; i++)
        {
            if ((RCSERVO_validChannels & (1L<<i)) == 0L) continue;
            midaction[i] = ((mix == NULL)? 0L : mix[i]) +
                interpolate(RCSERVO_lastaction[i], RCSERVO_curaction[i], tt, t);
        }
        set_playmode_pulses(midaction);

        while (RCSERVO_curaction_nexttime <= nowtime)
            RCSERVO_curaction_nexttime = RCSERVO_curaction_nexttime + RCSERVO_playInterval;
    }

    return RCSERVO_playState;
}


to RCSERVO.CPP; recompile the RoBoIO library and then you get a function rcservo_PlayAction_Mix() to support sensor mixing. This function receives an unsigned long array of 32 elements as input and add the array to the output action when updating PWM duty.

Please try it and report whether it is useful. If it is really useful, we will consider to add it into the next version of RoBoIO library. :)
roboard
Savvy Roboteer
Savvy Roboteer
Posts: 302
Joined: Fri Jul 03, 2009 4:44 am

Post by veltrop » Tue Aug 18, 2009 7:22 am

Post by veltrop
Tue Aug 18, 2009 7:22 am

Wonderful!

Well, I am sold. I am going to need to buy a Roboard. Thanks for the quick and thoughtful replies, you are a great representative for your company!
Wonderful!

Well, I am sold. I am going to need to buy a Roboard. Thanks for the quick and thoughtful replies, you are a great representative for your company!
veltrop
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 59
Joined: Wed Jul 22, 2009 8:04 am
Location: Japan

Post by ries » Wed Aug 19, 2009 7:22 am

Post by ries
Wed Aug 19, 2009 7:22 am

Thanks, just added the code to the rcservo.h and cpp files, compiled it and hopefully tonight I can test it.

Thanks for the support!!! Great job.

Regards
Thanks, just added the code to the rcservo.h and cpp files, compiled it and hopefully tonight I can test it.

Thanks for the support!!! Great job.

Regards
ries
Savvy Roboteer
Savvy Roboteer
Posts: 62
Joined: Sun Dec 16, 2007 11:33 am
Location: Netherlands


7 postsPage 1 of 1
7 postsPage 1 of 1