Hello,

First of all, thank you for a great library and my apologies for what I expect is quite a basic question.

I am using the RTS backward filter, with the example you include as a model for my code. In the example, the input is constant:

// Model of mobile robot in world with one wall // The model is used to simultate the distance measurements. MobileRobot mobile_robot; ColumnVector input(2); input(1) = 0.1; input(2) = 0.0;However, in my case the input varies over time and the input values are used in the system model. In the forward pass, I have code like this to fetch the input with a simple average to obtain an estimate of the average value in the time period between this step and the next:

cout << "MAIN: Starting estimation" << endl; unsigned int time_step; for (time_step = 0; time_step < NUM_TIME_STEPS; time_step++) { int nextStep = min(gyroRotationRate->Count-1,time_step+1); input(1) = (gyroRotationRate[time_step] + gyroRotationRate[nextStep]) / 2.0;[...]

The input I provide gets used in the ExpectedValueGet() function and everything appears to work well in the forward pass. The system model sums up the gyro rotation rates into an attitude estimate that looks sensible.

My question is about how to set the input() on the backward pass. At the moment I'm doing the same there and things aren't working very well (though the cause may be unrelated):

// BACKWARD PASS for (time_step = NUM_TIME_STEPS-1; time_step+1 > 0 ; time_step--) { int nextStep = min(gyroRotationRate->Count-1,time_step+1); input(1) = (gyroRotationRate[time_step] + gyroRotationRate[nextStep]) / 2.0; posteriors_it--; // UPDATE BACKWARDFILTER Gaussian filtered(posteriors_it->ExpectedValueGet(),posteriors_it->CovarianceGet()); backwardfilter.Update(&sys_model,input, &filtered);[...]

Am I picking up the right samples from mySamples[] on the backward pass, i.e. exactly what I fed in on that time_step on the forward pass? Or should it be:

int nextStep = max(0,time_step-1); // look back, because we're going backwardsThat does actually give me a better result but I don't understand what's going on "under the hood" well enough to know if it's right or just a coincidence.

Any guidance will be much appreciated!

Thank you,

Jungwon

## RTS backward filter with time-varying input

Hello Jungwon,

>

> First of all, thank you for a great library and my apologies for what I

> expect is quite a basic question.

Thanks for using our library, and I'm glad you like it.

All questions, even basic ones are always welcome!

>

> I am using the RTS backward filter, with the example you include as a model

> for my code. In the example, the input is constant:

>

> // Model of mobile robot in world with one wall

> // The model is used to simultate the distance measurements.

> MobileRobot mobile_robot;

> ColumnVector input(2);

> input(1) = 0.1;

> input(2) = 0.0;

>

> However, in my case the input varies over time and the input values are

> used in the system model. In the forward pass, I have code like this to

> fetch the input with a simple average to obtain an estimate of the average

> value in the time period between this step and the next:

>

> cout << "MAIN: Starting estimation" << endl;

> unsigned int time_step;

> for (time_step = 0; time_step < NUM_TIME_STEPS; time_step++)

> {

> int nextStep = min(gyroRotationRate->Count-1,time_step+1);

> input(1) = (gyroRotationRate[time_step] + gyroRotationRate[nextStep]) /

> 2.0; [...]

>

> The input I provide gets used in the ExpectedValueGet() function and

> everything appears to work well in the forward pass. The system model

> sums up the gyro rotation rates into an attitude estimate that looks

> sensible.

I will try to give my opinion on your problem.

I would not solve the problem of this time varying inputs like this. What I

would do is to make sure that you calculate the average input signal OUTSIDE

bfl, i.e. before calling the system update function: because you are

responsible to pass on the correct input signals (and you are responsible for

calculating them). This would make your ExpectedValueGet() simpler and more in

accordance with the KF idea where the expected value is only calculated from

the current input and state.

>

> My question is about how to set the input() on the backward pass. At the

> moment I'm doing the same there and things aren't working very well

> (though the cause may be unrelated):

>

> // BACKWARD PASS

> for (time_step = NUM_TIME_STEPS-1; time_step+1 > 0 ; time_step--)

> {

> int nextStep = min(gyroRotationRate->Count-1,time_step+1);

> input(1) = (gyroRotationRate[time_step] + gyroRotationRate[nextStep])

> / 2.0;

>

> posteriors_it--;

> // UPDATE BACKWARDFILTER

> Gaussian

> filtered(posteriors_it->ExpectedValueGet(),posteriors_it->CovarianceGet())

> ; backwardfilter.Update(&sys_model,input, &filtered);

> [...]

>

> Am I picking up the right samples from mySamples[] on the backward pass,

> i.e. exactly what I fed in on that time_step on the forward pass? Or

> should it be:

>

> int nextStep = max(0,time_step-1); // look back, because we're going

> backwards

>

> That does actually give me a better result but I don't understand what's

> going on "under the hood" well enough to know if it's right or just a

> coincidence.

I think that calculating the input outside bfl might solve your problem ....

Please let me know what you think.

Sorry for the delay in my reply!

Tinne

_______________________________________________

I hereby promise not to top-post on the

BFL mailing list

BFL [..] ...

http://lists.mech.kuleuven.be/mailman/listinfo/bfl

## RTS backward filter with time-varying input

Would be great to get an opinion on this if anyone has a moment.

Thank you,

Jungwon Kim

_______________________________________________

I hereby promise not to top-post on the

BFL mailing list

BFL [..] ...

http://lists.mech.kuleuven.be/mailman/listinfo/bfl

## RTS backward filter with time-varying input

Would be great to get an opinion on this if anyone has a moment.

Thank you,

Jungwon Kim

## RTS backward filter with time-varying input

On 29 December 2010 08:28, jungwon [dot] kim [..] ...

<jungwon [dot] kim [..] ...> wrote:

> Hello,

>

> First of all, thank you for a great library and my apologies for what I expect is quite a basic question.

>

> I am using the RTS backward filter, with the example you include as a model for my code. In the example, the input is constant:

>

> // Model of mobile robot in world with one wall

> // The model is used to simultate the distance measurements.

> MobileRobot mobile_robot;

> ColumnVector input(2);

> input(1) = 0.1;

> input(2) = 0.0;

>

> However, in my case the input varies over time and the input values are used in the system model. In the forward pass, I have code like this to fetch the input with a simple average to obtain an estimate of the average value in the time period between this step and the next:

>

> cout << "MAIN: Starting estimation" << endl;

> unsigned int time_step;

> for (time_step = 0; time_step < NUM_TIME_STEPS; time_step++)

> {

> int nextStep = min(gyroRotationRate->Count-1,time_step+1);

> input(1) = (gyroRotationRate[time_step] + gyroRotationRate[nextStep]) / 2.0;

> [...]

>

> The input I provide gets used in the ExpectedValueGet() function and everything appears to work well in the forward pass. The system model sums up the gyro rotation rates into an attitude estimate that looks sensible.

>

> My question is about how to set the input() on the backward pass. At the moment I'm doing the same there and things aren't working very well (though the cause may be unrelated):

>

> // BACKWARD PASS

> for (time_step = NUM_TIME_STEPS-1; time_step+1 > 0 ; time_step--)

> {

> int nextStep = min(gyroRotationRate->Count-1,time_step+1);

> input(1) = (gyroRotationRate[time_step] + gyroRotationRate[nextStep]) / 2.0;

>

> posteriors_it--;

> // UPDATE BACKWARDFILTER

> Gaussian filtered(posteriors_it->ExpectedValueGet(),posteriors_it->CovarianceGet());

> backwardfilter.Update(&sys_model,input, &filtered);

> [...]

>

> Am I picking up the right samples from mySamples[] on the backward pass, i.e. exactly what I fed in on that time_step on the forward pass? Or should it be:

>

> int nextStep = max(0,time_step-1); // look back, because we're going backwards

>

> That does actually give me a better result but I don't understand what's going on "under the hood" well enough to know if it's right or just a coincidence.

>

> Any guidance will be much appreciated!

>

> Thank you,

>

> Jungwon

>

Just to mention, most people here are currently on vacation so a reply

may come a little bit later.

Greetz,

Koen

> _______________________________________________

> I hereby promise not to top-post on the

> BFL mailing list

> BFL [..] ...

> http://lists.mech.kuleuven.be/mailman/listinfo/bfl

>

_______________________________________________

I hereby promise not to top-post on the

BFL mailing list

BFL [..] ...

http://lists.mech.kuleuven.be/mailman/listinfo/bfl

## RTS backward filter with time-varying input

Hello,

First of all, thank you for a great library and my apologies for what I expect is quite a basic question.

I am using the RTS backward filter, with the example you include as a model for my code. In the example, the input is constant:

// Model of mobile robot in world with one wall

// The model is used to simultate the distance measurements.

MobileRobot mobile_robot;

ColumnVector input(2);

input(1) = 0.1;

input(2) = 0.0;

However, in my case the input varies over time and the input values are used in the system model. In the forward pass, I have code like this to fetch the input with a simple average to obtain an estimate of the average value in the time period between this step and the next:

cout << "MAIN: Starting estimation" << endl;

unsigned int time_step;

for (time_step = 0; time_step < NUM_TIME_STEPS; time_step++)

{

int nextStep = min(gyroRotationRate->Count-1,time_step+1);

input(1) = (gyroRotationRate[time_step] + gyroRotationRate[nextStep]) / 2.0;

[...]

The input I provide gets used in the ExpectedValueGet() function and everything appears to work well in the forward pass. The system model sums up the gyro rotation rates into an attitude estimate that looks sensible.

My question is about how to set the input() on the backward pass. At the moment I'm doing the same there and things aren't working very well (though the cause may be unrelated):

// BACKWARD PASS

for (time_step = NUM_TIME_STEPS-1; time_step+1 > 0 ; time_step--)

{

int nextStep = min(gyroRotationRate->Count-1,time_step+1);

input(1) = (gyroRotationRate[time_step] + gyroRotationRate[nextStep]) / 2.0;

posteriors_it--;

// UPDATE BACKWARDFILTER

Gaussian filtered(posteriors_it->ExpectedValueGet(),posteriors_it->CovarianceGet());

backwardfilter.Update(&sys_model,input, &filtered);

[...]

Am I picking up the right samples from mySamples[] on the backward pass, i.e. exactly what I fed in on that time_step on the forward pass? Or should it be:

int nextStep = max(0,time_step-1); // look back, because we're going backwards

That does actually give me a better result but I don't understand what's going on "under the hood" well enough to know if it's right or just a coincidence.

Any guidance will be much appreciated!

Thank you,

Jungwon

_______________________________________________

I hereby promise not to top-post on the

BFL mailing list

BFL [..] ...

http://lists.mech.kuleuven.be/mailman/listinfo/bfl