How to make cozmo automatically detect cube and move forward
thunderslack91 opened this issue · 1 comments
thunderslack91 commented
All the code managed to work except the last line of the code. My code is unable to make the cozmo go towards the cube.
if (intentName=="findcube")
{
// pythonCode += tabs + "\trobot.play_anim_trigger(cozmo.anim.Triggers.MajorWin)\n";
pythonCode += tabs + "\tcube1 = robot.world.get_light_cube(LightCube1Id)\n";
pythonCode += tabs + "\tcube2 = robot.world.get_light_cube(LightCube2Id)\n";
pythonCode += tabs + "\tcube3 = robot.world.get_light_cube(LightCube3Id)\n\n";
pythonCode += tabs + "\tcube1.set_lights(cozmo.lights.green_light)\n";
pythonCode += tabs + "\ttime.sleep(3)\n";
pythonCode += tabs + "\tcube2.set_lights(cozmo.lights.green_light)\n";
pythonCode += tabs + "\tcube3.set_lights(cozmo.lights.green_light)\n";
pythonCode += tabs + "\ttime.sleep(3)\n";
pythonCode += tabs + "\trobot.start_behavior(cozmo.behavior.BehaviorTypes.LookAroundInPlace)\n";
pythonCode += tabs + "\trobot.world.wait_for_observed_light_cube(timeout = 30)\n";
pythonCode += tabs + "\trobot.start_behavior(cozmo.behavior.BehaviorTypes.LookAroundInPlace).Stop()\n";
pythonCode += tabs + "\trobot.go_to_object(cube, distance_mm(70.0)).wait_for_completed()\n";
}
msintov commented
Hi @thunderslack91! Our forums (https://forums.anki.com) are a better place to ask these sorts of questions to get community feedback as well as access to Anki developers. github issues should be instead specific bugs with or possible improvements to the Anki Cozmo SDK Python code itself.