MVWT Vision System

From Murray Wiki
Jump to navigationJump to search

The MVWT Vision System operates the four cameras on the ceiling over the testbed and determines the position and orientation of all the robots with hats on the testbed. The vision system will not recognize robots without hats and will not recognize hats that are not near its focus level, which is about 20 cm above the raised floor.

The routine that should be running on the vision system computers (north end of the lab) is called vision_static. Start vision_static by clicking on its icon in Windows. You may get an error message error in imDevAlloc() during startup; this can be ignored. You should see a line with the following elements:

  • frame: should be counting up rapidly
  • car_found: a binary sequence where the ones indicate which hats the vision system has detected on the floor
  • fps: should be around 50 or so; if fps drops to zero you need to restart the vision system.

Data Structure

A copy of the following data structure is produced by the vision system for each robot. This is found in MVWT1VisionPacket.h.

typedef struct
{
    double timestamp;
    struct
    {
	double x;
	double y;
	double theta;
	double xdot;
	double ydot;
	double thetadot;
    } vehicle[NUM_VEHICLES];
} VisionPacket;


Handing Vision Data

As an example, the function int handle_vision() is use to process vision data by each robot running the code RFController.c.

Each robot first attempts to receive data from the vision socket. If no data is received, the message "could not receive vision packet" is printed. If a message is received, the robot than checks to see if it's complete - it not, the packet is dropped. If too many consecutive packets are dropped, the robot declares itself invisible to the vision system.

The function extracts the robot's angle theta from the vision system and resets its orientation based on what the vision system reports. It then checks to see if there are any commands waiting on the command socket and executes them if the robot is visible to the vision system.

mlogger.c

The file mlogger.c will log data received from the vision system and write it out to a Matlab .m file.