View unanswered posts | View active topics It is currently Sun Oct 21, 2018 6:53 pm






Reply to topic  [ 9 posts ] 
Camera for ev3 
Author Message
Rookie

Joined: Fri Mar 27, 2015 8:22 am
Posts: 11
Post Camera for ev3
Hi

We are trying to learn how to use the camera. We read that nxtcam supports ev3.

We searched but only found examples for NXT. Would have any examples in ev3 we could see for understand the instructions?

Thanks


Mon Apr 20, 2015 5:35 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Camera for ev3
The examples should work fine for both NXT and EV3. Take a look at the examples in my driver suite: https://github.com/botbench/robotcdriversuite

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Apr 21, 2015 12:25 am
Profile WWW
Rookie

Joined: Fri Mar 27, 2015 8:22 am
Posts: 11
Post Re: Camera for ev3
Very thanks for you help.

to see if I can understand the programs xD


Thu Apr 23, 2015 3:18 am
Profile
Rookie

Joined: Fri Mar 27, 2015 8:22 am
Posts: 11
Post Re: Camera for ev3
Hello.
How could I know the value taken by the camera as a central position?

Thanks.


Mon Apr 27, 2015 4:02 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Camera for ev3
I am not sure I understand your question.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Apr 27, 2015 4:11 am
Profile WWW
Rookie

Joined: Fri Mar 27, 2015 8:22 am
Posts: 11
Post Re: Camera for ev3
I'm trying to follow a ball and I wonder what condition used, to make it go in a direcion or other


Mon Apr 27, 2015 4:52 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: Camera for ev3
You follow the biggest blob in your field of vision, as detected by the camera and apply a simply PID algorithm to control the motor that points the camera at the centre of the ball. That means that if you find the centre of the ball moving towards the right of your vision, you move the camera in that direction, proportionally to the offset of the ball's centre in comparison to the desired position of it (the centre of your screen).

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Apr 27, 2015 5:13 am
Profile WWW
Rookie

Joined: Fri Mar 27, 2015 8:22 am
Posts: 11
Post Re: Camera for ev3
thanks for your help·


Mon Apr 27, 2015 7:12 am
Profile
Rookie

Joined: Fri Mar 27, 2015 8:22 am
Posts: 11
Post Re: Camera for ev3
I'm trying to follow a ball with the following program

Code:
#include "C:\Program Files (x86)\Robomatter Inc\ROBOTC Development Environment 4.X\Sample Programs\EV3\3rd Party Driver Library\include\mindsensors-nxtcam.h"

task main () {
   blob_array _blobs;
   memset(_blobs, 0, sizeof(_blobs));
   bool _condensed=true;
   int _l,_t,_r,_b;
   int _nblobs=0;
   float xcenter=0;

   _l=0;_t=0;_r=0;_b=0;
   eraseDisplay();
   NXTCAMinit(cam);
   while(true)
   {
      eraseDisplay();
      displayCenteredBigTextLine(5,"%f",xcenter);
      _nblobs=NXTCAMgetBlobs(cam,_blobs,_condensed);
      for(int i=0;i<_nblobs;i++)
      {
         
         _l=(_blobs[i].x1);
         _r=(_blobs[i].x2);
         _t=(_blobs[i].y1);
         _b=(_blobs[i].y2);
      }

      xcenter=(_l+_r)/2;

      if (_nblobs >=1 && getUSDistance(S4)>5)
      {
         if(xcenter>97 && xcenter<=120)
         {
            setMotorSpeed(motorC,30);
            setMotorSpeed(motorD,23);
         }
         if(xcenter>120 && xcenter<=140)
         {
            setMotorSpeed(motorC,30);
            setMotorSpeed(motorD,17);
         }
         else if (xcenter>140)
         {
            setMotorSpeed(motorC,30);
            setMotorSpeed(motorD,12);
         }
         else if (xcenter<87 && xcenter>=65)
         {
            setMotorSpeed(motorC,23);
            setMotorSpeed(motorD,30);
         }
         else if (xcenter<65 && xcenter>=45)
         {
            setMotorSpeed(motorC,17);
            setMotorSpeed(motorD,30);
         }
         else if (xcenter<45)
         {
            setMotorSpeed(motorC,12);
            setMotorSpeed(motorD,30);
         }
         else if (xcenter>=87 && xcenter<=97)
         {
            setMotorSpeed(motorC,30);
            setMotorSpeed(motorD,30);
         }
      }
      else if (_nblobs ==0 && getUSDistance(S4)>5)
      {
         setMotorSpeed(motorC,10);
         setMotorSpeed(motorD,-10);
      }
      else if(getUSDistance(S4)<=5)
      {
         setMotorSpeed(motorC,0);
         setMotorSpeed(motorD,0);
      }
   }
}


when I put the ball in front of the camera the robot follows the ball without any problems, but when I throw the ball, the robot does not have time to read it and do not follow.

How I can make the robot follow the ball when I throw?

Sorry my level of englihs


Mon May 04, 2015 5:27 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.