View unanswered posts | View active topics It is currently Thu Dec 05, 2019 10:23 am






Reply to topic  [ 2 posts ] 
RAnxtCamLib.c and NXTCam V3 
Author Message
Rookie

Joined: Thu May 17, 2012 3:35 pm
Posts: 38
Post RAnxtCamLib.c and NXTCam V3
Hello
I'm trying to use the V3 Camera with the NXT . I've tried all the programs . The camera works, but in RobotC I get involved in the RAnxtCamLib.c following error :

Code:
**Error**:'*' Indirection levels mismatch. Call to 'readI2CReply'. Parameter: 'char * pReplyBytes' is 'dump[0]' of type 'byte'.
**Error**:'*' Indirection levels mismatch. Call to 'sendI2CMsg'. Parameter: 'char * pSendMsg' is 'msg[0]' of type 'byte'.
**Error**:'*' Indirection levels mismatch. Call to 'sendI2CMsg'. Parameter: 'char * pSendMsg' is 'msg[0]' of type 'byte'.
**Error**:'*' Indirection levels mismatch. Call to 'readI2CReply'. Parameter: 'char * pReplyBytes' is 'reply[0]' of type 'byte'.
**Error**:'*' Indirection levels mismatch. Call to 'sendI2CMsg'. Parameter: 'char * pSendMsg' is 'msg[0]' of type 'byte'.
**Error**:'*' Indirection levels mismatch. Call to 'readI2CReply'. Parameter: 'char * pReplyBytes' is 'reply[0]' of type 'byte'.



Where is the mistake?
mindsensors has a new pages and no more examples there....

If I " Library functions and sample program for RobotC NXTCam & Pixy " take the , then I get :
Code:
*Warning*:Unreferenced function 'init_camera'
*Warning*:Unreferenced function 'get_blobs'
*Warning*:Unreferenced variable 'count'
**Error**:Undefined procedure 'enableTracking'.
**Error**:Undefined procedure 'sortBySize'.
**Error**:Undefined procedure 'useObjectTracking'.
**Error**:Undefined procedure 'getCameraData'.


Program: (Colored Object Tracking from programs.zip)
Code:
#pragma config(Sensor, S1,     camera1,             sensorI2CCustomFast)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*
Colored Object Tracking - ROBOTC for the NXT

Description: The NXT searches for and tracks an object of a certain color.

NXT Configuration:
- Mindsensors NXTCam v2 plugged into NXT Sensor Port 1
- Motors in Ports B & C

Notes:
- At least one color on the NXTCam must be defined
- As of October 2008, NXTCam color index must be configured through
NXTCamView, found at: http://nxtcamview.sourceforge.net/
- More information can be found at: http://mindsensors.com/index.php?module=pagemaster&PAGE_user_op=view_page&PAGE_id=78
*/

//Include Mindsensors NXTCam Library
#include "D:\nxtCamLib.c"

//Define global variables
int area, numBlobs, count;
int_array blobColor;
int_array blobX1;
int_array blobTop;
int_array blobX2;
int_array blobBottom;

void findBlob(int colorNumber);
void trackBlob(int colorNumber, int endArea);

task main ()
{
   //Initialize the NXTCam
   enableTracking(camera1);
   wait1Msec(500);
   sortBySize(camera1);
   wait1Msec(500);
   useObjectTracking(camera1);
   wait1Msec(500);

   //nMotorPIDSpeedCtrl[motorB] = mtrSpeedReg;
   //nMotorPIDSpeedCtrl[motorC] = mtrSpeedReg;

  while(true)
  {
    trackBlob(0, 4000);  //Tracks a blob that is the color of NXTCam Index 0
  }
}

/*Function finds desired blob color. "colorNumber" corresponds to color index
of onboard camera, determined by NXTCamView software, valid values range from 0-7.*/
void findBlob(int colorNumber)
{
   //Retrieve blob data, if any
  getCameraData(camera1, numBlobs, blobColor, blobX1, blobTop, blobX2, blobBottom);
  //While the blob is not the desired color or there are no blobs seen, point turn and scan
  while(colorNumber != blobColor || numBlobs < 1)
  {
    motor[motorB] = 25;
    motor[motorC] = -25;
    getCameraData(camera1, numBlobs, blobColor, blobX1, blobTop, blobX2, blobBottom);
    nxtDisplayTextLine(0, "Finding Blob");
  }
  motor[motorB] = 0;
  motor[motorC] = 0;
}

/*Function tracks the desired blob color, while area of the blob is less than "endArea"*/
void trackBlob(int colorNumber, int endArea)
{
   findBlob(colorNumber);
  area = (blobX2 - blobX1) * (blobBottom - blobTop); //Calculate the area

  while(area < endArea)
  {
     nxtDisplayTextLine(0, "Tracking Blob");
     //If more of the blob is on the right than the left of the camera view
     //Camera has a resolution of 176x144 (supposedly)
    if(blobX1 > (210-blobX2))
    {
      nxtDisplayTextLine(1, "Turning Right");
      motor[motorB] = 20;
      motor[motorC] = 50;
    }
    //If more of the blob is on the left than the right of the camera view
    if(blobX1 <= (210-blobX2))
    {
      nxtDisplayTextLine(1, "Turning Left ");
      motor[motorB] = 50;
      motor[motorC] = 20;
    }
    findBlob(colorNumber);
    area = (blobX2 - blobX1) * (blobBottom - blobTop);
    nxtDisplayTextLine(6, "Area: %d", area);
  }
   motor[motorB] = 0;
  motor[motorC] = 0;
}


RobotC 4.5.2


Mon Feb 01, 2016 11:51 am
Profile
Site Admin
Site Admin
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3654
Location: Rotterdam, The Netherlands
Post Re: RAnxtCamLib.c and NXTCam V3
That driver seems to be made for ROBOTC 3.x. I have a driver in my suite that should work with ROBOTC 4.x. You can find it here: 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]


Mon Feb 01, 2016 12:50 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 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.