Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
24 Views

R300 can not be accessed

Jump to solution

Hi, all.

When I using the F200 and R300 with VS2013 under suitable condition, there is always an error:

Uhandled exception at 0x003FC476 in xxx.exe: 0xC0000005: Acess voilation reading location 0x00000000.

At first, I thought there was something with the F200, and I bought a new R300, but this problem still ocurred. Could anyone help me out of this strait?

Thanks. 

0 Kudos

Accepted Solutions
Highlighted
Valued Contributor II
24 Views

Here's my device selection method, modified from the samples:

public Tuple<PXCMCapture.DeviceInfo, int> GetSelectedDevice(string cameraName)
        {//Find RealSense device by name
            try
            {
                if (cameraName == null) cameraName = "";
                PXCMSession g_session = PXCMSession.CreateInstance();
                PXCMSession.ImplDesc desc = new PXCMSession.ImplDesc();
                desc.group = PXCMSession.ImplGroup.IMPL_GROUP_SENSOR;
                desc.subgroup = PXCMSession.ImplSubgroup.IMPL_SUBGROUP_VIDEO_CAPTURE;
                PXCMCapture.DeviceInfo dinfo0 = null;
                int iuid0 = -1;
                for (int i = 0; ; i++)
                {
                    PXCMSession.ImplDesc desc1;
                    if (g_session.QueryImpl(desc, i, out desc1) < pxcmStatus.PXCM_STATUS_NO_ERROR) break;
                    PXCMCapture capture;
                    if (g_session.CreateImpl<PXCMCapture>(desc1, out capture) < pxcmStatus.PXCM_STATUS_NO_ERROR) continue;
                    for (int j = 0; ; j++)
                    {
                        PXCMCapture.DeviceInfo dinfo;
                        if (capture.QueryDeviceInfo(j, out dinfo) < pxcmStatus.PXCM_STATUS_NO_ERROR) break;
                        if (dinfo0 == null && dinfo.model != PXCMCapture.DeviceModel.DEVICE_MODEL_GENERIC)//Check it's realsense compatible
                        {
                            //Remember the first realsense device we find in case the preferred isn't available.
                            dinfo0 = dinfo;
                            iuid0 = desc1.iuid;
                        }
                        if (dinfo.name == cameraName)
                        {
                            return new Tuple<PXCMCapture.DeviceInfo, int>(dinfo, desc1.iuid);
                        }
                    }
                    capture.Dispose();
                }
                if (dinfo0 != null) return new Tuple<PXCMCapture.DeviceInfo, int>(dinfo0, iuid0); //default to first device if preferred not found or not specified
            }
            catch(Exception e)
            {
                throw new Exception("Problem getting device: " + e.ToString());
            }
            return null;
        }

It returns the deviceInfo and the IUID (which I use for getting the stream profiles - you may not need this so could get away with just returning deviceInfo).

View solution in original post

0 Kudos
8 Replies
Highlighted
New Contributor II
24 Views

Hi,

Can you kindly answer both these questions first. It'll help resolve the issue faster.

1. Have you downloaded the drivers for both the cameras?
2. Are you using Librealsense for using both the cameras?

0 Kudos
Highlighted
Beginner
24 Views

Rishabh Banga wrote:

Hi,

Can you kindly answer both these questions first. It'll help resolve the issue faster.

1. Have you downloaded the drivers for both the cameras?
2. Are you using Librealsense for using both the cameras?

Yes, of course.

I downloaded the latest corrsponding DCMs for F200 and SR300, but in different computers. I used the F200 with a notebook (lenovo x250), SR300 with a desktop (Thinkcentre M8600t), the computer environment meets the requiremnts respectively. Actually, F200 and SR300 worked in different computers, but I used them same with C++ on VS2013, and called the cameras with the props sheet in the SDK. I have no idea where the problem is.

0 Kudos
Highlighted
Valued Contributor II
24 Views

Are you trying to specifically call the camera by name? Try just doing a generic camera call to pick up whatever RealSense device is available. You can make it so that it searches for your preferred camera if you have more than one connected, but will return a different device if it can't find that one. Some of the SDK samples contain code for camera selection if you don't have it already.

0 Kudos
Highlighted
Beginner
24 Views

James B. wrote:

Are you trying to specifically call the camera by name? Try just doing a generic camera call to pick up whatever RealSense device is available. You can make it so that it searches for your preferred camera if you have more than one connected, but will return a different device if it can't find that one. Some of the SDK samples contain code for camera selection if you don't have it already.

Thanks, James. What you said here is quite right. But in my case, I used the F200 in lenovo X250 and SR300 in ThinkCentre M8600t. I never used them in the same computer. So, I think it's not the camera name that caused this kind of problem.

0 Kudos
Highlighted
Valued Contributor II
24 Views

If you'll only ever have one camera connected at a time, why bother calling it by name? If you just select the default camera it'll grab whatever realsense device is connected and save any potential problems if they change the camera names etc.

0 Kudos
Highlighted
Beginner
24 Views

James B. wrote:

If you'll only ever have one camera connected at a time, why bother calling it by name? If you just select the default camera it'll grab whatever realsense device is connected and save any potential problems if they change the camera names etc.

Sorry, James. I didn't know how to call a camera by name, I just could use it by its device index. Could you please tell me the way to call the camera by name?

0 Kudos
Highlighted
Valued Contributor II
25 Views

Here's my device selection method, modified from the samples:

public Tuple<PXCMCapture.DeviceInfo, int> GetSelectedDevice(string cameraName)
        {//Find RealSense device by name
            try
            {
                if (cameraName == null) cameraName = "";
                PXCMSession g_session = PXCMSession.CreateInstance();
                PXCMSession.ImplDesc desc = new PXCMSession.ImplDesc();
                desc.group = PXCMSession.ImplGroup.IMPL_GROUP_SENSOR;
                desc.subgroup = PXCMSession.ImplSubgroup.IMPL_SUBGROUP_VIDEO_CAPTURE;
                PXCMCapture.DeviceInfo dinfo0 = null;
                int iuid0 = -1;
                for (int i = 0; ; i++)
                {
                    PXCMSession.ImplDesc desc1;
                    if (g_session.QueryImpl(desc, i, out desc1) < pxcmStatus.PXCM_STATUS_NO_ERROR) break;
                    PXCMCapture capture;
                    if (g_session.CreateImpl<PXCMCapture>(desc1, out capture) < pxcmStatus.PXCM_STATUS_NO_ERROR) continue;
                    for (int j = 0; ; j++)
                    {
                        PXCMCapture.DeviceInfo dinfo;
                        if (capture.QueryDeviceInfo(j, out dinfo) < pxcmStatus.PXCM_STATUS_NO_ERROR) break;
                        if (dinfo0 == null && dinfo.model != PXCMCapture.DeviceModel.DEVICE_MODEL_GENERIC)//Check it's realsense compatible
                        {
                            //Remember the first realsense device we find in case the preferred isn't available.
                            dinfo0 = dinfo;
                            iuid0 = desc1.iuid;
                        }
                        if (dinfo.name == cameraName)
                        {
                            return new Tuple<PXCMCapture.DeviceInfo, int>(dinfo, desc1.iuid);
                        }
                    }
                    capture.Dispose();
                }
                if (dinfo0 != null) return new Tuple<PXCMCapture.DeviceInfo, int>(dinfo0, iuid0); //default to first device if preferred not found or not specified
            }
            catch(Exception e)
            {
                throw new Exception("Problem getting device: " + e.ToString());
            }
            return null;
        }

It returns the deviceInfo and the IUID (which I use for getting the stream profiles - you may not need this so could get away with just returning deviceInfo).

View solution in original post

0 Kudos
Highlighted
Beginner
24 Views

James B. wrote:

Here's my device selection method, modified from the samples:

public Tuple<PXCMCapture.DeviceInfo, int> GetSelectedDevice(string cameraName)
        {//Find RealSense device by name
            try
            {
                if (cameraName == null) cameraName = "";
                PXCMSession g_session = PXCMSession.CreateInstance();
                PXCMSession.ImplDesc desc = new PXCMSession.ImplDesc();
                desc.group = PXCMSession.ImplGroup.IMPL_GROUP_SENSOR;
                desc.subgroup = PXCMSession.ImplSubgroup.IMPL_SUBGROUP_VIDEO_CAPTURE;
                PXCMCapture.DeviceInfo dinfo0 = null;
                int iuid0 = -1;
                for (int i = 0; ; i++)
                {
                    PXCMSession.ImplDesc desc1;
                    if (g_session.QueryImpl(desc, i, out desc1) < pxcmStatus.PXCM_STATUS_NO_ERROR) break;
                    PXCMCapture capture;
                    if (g_session.CreateImpl<PXCMCapture>(desc1, out capture) < pxcmStatus.PXCM_STATUS_NO_ERROR) continue;
                    for (int j = 0; ; j++)
                    {
                        PXCMCapture.DeviceInfo dinfo;
                        if (capture.QueryDeviceInfo(j, out dinfo) < pxcmStatus.PXCM_STATUS_NO_ERROR) break;
                        if (dinfo0 == null && dinfo.model != PXCMCapture.DeviceModel.DEVICE_MODEL_GENERIC)//Check it's realsense compatible
                        {
                            //Remember the first realsense device we find in case the preferred isn't available.
                            dinfo0 = dinfo;
                            iuid0 = desc1.iuid;
                        }
                        if (dinfo.name == cameraName)
                        {
                            return new Tuple<PXCMCapture.DeviceInfo, int>(dinfo, desc1.iuid);
                        }
                    }
                    capture.Dispose();
                }
                if (dinfo0 != null) return new Tuple<PXCMCapture.DeviceInfo, int>(dinfo0, iuid0); //default to first device if preferred not found or not specified
            }
            catch(Exception e)
            {
                throw new Exception("Problem getting device: " + e.ToString());
            }
            return null;
        }

It returns the deviceInfo and the IUID (which I use for getting the stream profiles - you may not need this so could get away with just returning deviceInfo).

Thanks, James.

0 Kudos