HULKs / NaoV6

A collection of good-to-know knowledge for the NaoV6 Robot in the Robocup context.
2 stars 0 forks source link

File descriptor in the “Read Write Camera Registers” page #2

Closed raymonlo-git closed 5 years ago

raymonlo-git commented 5 years ago

Hi @rkost, in the code you share in your “Read Write Camera Registers” page, would you mind also sharing the code for opening the file descriptor? I don’t know how to open the file descriptor for accessing the cameras on NAO. It would be great if you can share the missing piece.

rkost commented 5 years ago

If you only need the code for opening the fd this is it:

  device = (camera_ == Camera::TOP) ? "/dev/video-top" : "/dev/video-bottom";
  fd_ = open(device.c_str(), O_RDWR | O_NONBLOCK);
  if (fd_ < 0)
  {
    // bad state
  }