0

Can anyone help me with the code-ing to allow the robot to stop at a certain distance when the robot is approaching the tracked object. I am trying to implement it as a colour tracking wheel chair. For Example, the motorized wheelchair is able to track the colour of the shirt of the person infront is wearing and follow the person, and at the same time it is able to leave a distance between the person infront and the wheelchair to prevent collision.

the pixy robot : https://learn.adafruit.com/pixy-pet-robot-color-vision-follower-using-pixycam/overview

The code :https://learn.adafruit.com/pixy-pet-robot-color-vision-follower-using-pixycam/the-code

Currently the code is only able to track the object till it reaches the object. But my objective is to let it chase the object, but at the same time, leaving a 1 metre distance away from the object.

Please help me. Thank you

1

Try to play with this one:

int forwardSpeed = constrain(400 - (size/256), -100, 400);

By changing the value of 256 and 400, not at the same time though, you better use 2 potentiometer to change those values. That's a trial and error though, I hope this will give you an idea.

0

Old question, but I'd simply use the angle of the Pixy tilt mechanism. If the camera is mounted low (on a wheelchair) and looking up (to see a t-shirt), the angle will be more "up" when the t-shirt is close.

void loop()
{
   if(tiltAngle < 45) // Angle in degrees 
      moveWheelChairForward();
}

However, if someone bends down, the tilt angle will go down, so the wheelchair will ram them! Thus, a proximity sensor is probably still going to be needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.