Reputation: 13
PROBLEM: SetHeading API doesn't calibrate Sphero.
I am building a small little custom app with Sphero and would like to implement a configuration UI. However, I am not using the RobotLibrary but instead making Sphero API calls.
When implementing the Sphero calibration steps:
I issue the SetHeading command with the heading data, but the device doesn't not adjust.
Alternatively, I can send the Roll command with a velocity of zero and the heading data and the device does adjust in place. However, after calibration is over, when I attempt to "Roll" the device, the device with adjust back to original calibration and then move.
CONCLUSION: It seems that Roll command with a zero velocity is not the correct way to calibration the Sphero but SetHeading doesn't do anything. I have tried the SetHeading with SetStabilization on and off. Neither effects SetHeading and aids the calibration.
Any help would be appreciated.
Upvotes: 0
Views: 561
Reputation: 4375
It was a bit tricky to get it to work properly, here is the snippet I am using:
sphero.roll(0, heading, 2, ()=> {
setTimeout(()=> {
sphero.setHeading(0, ()=> {
sphero.roll(0, 0, 1, ()=> {
//done
});
});
}, 300);
});
Upvotes: 0
Reputation: 121
Use the Roll command with zero velocity to 'aim' the robot. As you noted, lighting the back led is helpful. Once done aiming, call SetHeading with 0 degrees heading parameter.
Upvotes: 1