hey guys, i'm having a compiler error.. here's the error message:
note: in expansion of macro 'sq'
totalDistance=sqrt(sq(vector[0]-feedback[0])+sq(vector[1]-feedback[1])sq(vector[2]-feedback[2]));
^
error: expression cannot be used as a function
#define sq(x) ((x)*(x))
^
the code in question is just a 3d distance formula:
void motion_planner(){
if (moving== false) {
if (execute==true) {
totalDistance=sqrt(sq(vector[0]-feedback[0])+sq(vector[1]-feedback[1])sq(vector[2]-feedback[2]));
for (int i=0; i<=2; i++) {
velocitysetpoint[i]=((vector[i]-feedback[i])*(feedrate))/totalDistance;
}
execute=false;
}
moving=true;
}
}
any advice would be appreciated. thanks in advance!