0

Im trying to create a PID controller:

PID* nsController = new PID(&double(imu.ypr[2]*), &nsOut, 
                             &nsSet, 7, 0.0, 1.1, REVERSE);

error: expected primary-expression before 'double'

imu.ypr is float ypr[3];
PID canditates are: PID::PID(double*, double*, double*, double, double, double, int)

what does that error mean? and how to fix? Im just trying to convert float to double. What does the * and & mean? Thank you

4

1 回答 1

2

You can't take the address of a temporary like that.

Instead, create a new local variable and pass that in:

double val = imu.ypr[2];
PID* nsController = new PID(&val, &nsOut, 
                         &nsSet, 7, 0.0, 1.1, REVERSE);
于 2013-03-30T02:35:49.157 回答