Building Micro-Manager Device Adapters

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Building Micro-Manager Device Adapters

Jacob Newman (CMP)
Hi all,

I'm new to this, and have been instructed to write a device adapter for a custom-built stage. The stage simply rotates when the correct hex value is to sent to it through the serial port.

This page seemed to be the perfect place to start:
http://valelab.ucsf.edu/~MM/MMwiki/index.php/Building_Micro-Manager_Device_Adapters

I assumed that once I'd built the example adapters, I could cannibalise some code from the existing stage adapters to satisfy my simple requirements.

So far, I have checked out both Micromanager 1.4 and the 3rdpartypublic directory, and have positioned them as described in the tutorial.

At the point of building LibraryTest, I come across my first problem. The error I get is that the bin file for libboost_date_time-vc100 cannot be found, and hence, linked. The 3rdpartypublic directory only seems to contain vc90, so my amateurish guess is that the version of micromanager I've checked out is not compatible with the 3rdpartypublic directory.

Does anyone have any ideas how to overcome this, please?

By the way, I am running Windows 7 and MS Visual Studio 2010 (so the .sln file was processed by the conversion wizard).

If you have any questions, please ask, and thanks for your time.

Jacob Newman



------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Building Micro-Manager Device Adapters

Arthur D. Edelstein
Hi Jacob,

> At the point of building LibraryTest, I come across my first problem. The error I get is that the bin file for libboost_date_time-vc100 cannot be found, and hence, linked. The 3rdpartypublic directory only seems to contain vc90, so my amateurish guess is that the version of micromanager I've checked out is not compatible with the 3rdpartypublic directory.
> By the way, I am running Windows 7 and MS Visual Studio 2010 (so the .sln file was processed by the conversion wizard).

I think the vc100 suffix appears automatically because you are using
Visual Studio 2010. Because we build Micro-Manager with Visual Studio
Express 2008 (aka VS v.9) we need version vc90. So my suggestion is to
download VS Express 2008 (it's free) and try building Micro-Manager
with that. The alternative is to build your boost library for vc100,
but this is a lot of extra effort.

One of these days we may upgrade to VS2010, but because everything is
already working, it's not a high priority.

I hope this helps!

Best regards,
Arthur

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Building Micro-Manager Device Adapters

Jacob Newman (CMP)
Hi Arthur (or anyone else interested),

Thanks for getting back to me so promptly.

I have now successfully compiled and included a device adapter DLL in Micromanager.

However, I've got a new problem that I wonder if you could help me with.

I've made my own copy of the Nikon project (attached the cpp I've been editing), as I wanted to use the z-stage part of that as the basis for my own adapter. We have a rotating stage which steps each time 0x18 0xFF is sent via serial port. The device has no other functions, and does not write back to the serial port at any time.

I commented out all the shutter and camera code from that project, and it was trivial to alter the SendSerialCommand to send the hex values 0x18 0xFF to my rotating stage.

It compiled, I can select my new device in the list, choose it's port, and when I put the send command in the initialise method (for testing purposes), my stage rotates. Success!

The problem I have is when the hardware wizard ends. The ZStage::OnPort method seems to run twice (I made it write to the serial port so I could see which methods were getting executed) and then MMCore crashes. I wondered if it was my hacked code for the methods for getting and setting the position of the stage, but they don't even seem to get executed. Is it possible I am setting properties that my device does not have? A z-stage seems to control focus, and obviously a stage which rotates around the z-axis, does not.

Sorry I'm such a novice at this. I would be very grateful for your expertise! Thank you in advance.

Jacob



On 3 Jan 2012, at 23:42, Arthur D. Edelstein wrote:

> Hi Jacob,
>
>> At the point of building LibraryTest, I come across my first problem. The error I get is that the bin file for libboost_date_time-vc100 cannot be found, and hence, linked. The 3rdpartypublic directory only seems to contain vc90, so my amateurish guess is that the version of micromanager I've checked out is not compatible with the 3rdpartypublic directory.
>> By the way, I am running Windows 7 and MS Visual Studio 2010 (so the .sln file was processed by the conversion wizard).
>
> I think the vc100 suffix appears automatically because you are using
> Visual Studio 2010. Because we build Micro-Manager with Visual Studio
> Express 2008 (aka VS v.9) we need version vc90. So my suggestion is to
> download VS Express 2008 (it's free) and try building Micro-Manager
> with that. The alternative is to build your boost library for vc100,
> but this is a lot of extra effort.
>
> One of these days we may upgrade to VS2010, but because everything is
> already working, it's not a high priority.
>
> I hope this helps!
>
> Best regards,
> Arthur
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
> _______________________________________________
> micro-manager-general mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/micro-manager-general


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general

NewStage.cpp (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Building Micro-Manager Device Adapters

Jacob Newman (CMP)
In reply to this post by Arthur D. Edelstein
Hi Arthur (or anyone else interested),

Thanks for getting back to me so promptly.

I have now successfully compiled and included a device adapter DLL in Micromanager.

However, I've got a new problem that I wonder if you could help me with.

I've made my own copy of the Nikon project (attached the cpp I've been editing), as I wanted to use the z-stage part of that as the basis for my own adapter. We have a rotating stage which steps each time 0x18 0xFF is sent via serial port. The device has no other functions, and does not write back to the serial port at any time.

I commented out all the shutter and camera code from that project, and it was trivial to alter the SendSerialCommand to send the hex values 0x18 0xFF to my rotating stage.

It compiled, I can select my new device in the list, choose it's port, and when I put the send command in the initialise method (for testing purposes), my stage rotates. Success!

The problem I have is when the hardware wizard ends. The ZStage::OnPort method seems to run twice (I made it write to the serial port so I could see which methods were getting executed) and then MMCore crashes. I wondered if it was my hacked code for the methods for getting and setting the position of the stage, but they don't even seem to get executed. Is it possible I am setting properties that my device does not have? A z-stage seems to control focus, and obviously a stage which rotates around the z-axis, does not.

Sorry I'm such a novice at this. I would be very grateful for your expertise! Thank you in advance.

Jacob



On 3 Jan 2012, at 23:42, Arthur D. Edelstein wrote:

> Hi Jacob,
>
>> At the point of building LibraryTest, I come across my first problem. The error I get is that the bin file for libboost_date_time-vc100 cannot be found, and hence, linked. The 3rdpartypublic directory only seems to contain vc90, so my amateurish guess is that the version of micromanager I've checked out is not compatible with the 3rdpartypublic directory.
>> By the way, I am running Windows 7 and MS Visual Studio 2010 (so the .sln file was processed by the conversion wizard).
>
> I think the vc100 suffix appears automatically because you are using
> Visual Studio 2010. Because we build Micro-Manager with Visual Studio
> Express 2008 (aka VS v.9) we need version vc90. So my suggestion is to
> download VS Express 2008 (it's free) and try building Micro-Manager
> with that. The alternative is to build your boost library for vc100,
> but this is a lot of extra effort.
>
> One of these days we may upgrade to VS2010, but because everything is
> already working, it's not a high priority.
>
> I hope this helps!
>
> Best regards,
> Arthur
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
> _______________________________________________
> micro-manager-general mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/micro-manager-general


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general

NewStage.cpp (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Building Micro-Manager Device Adapters

Arthur D. Edelstein
In reply to this post by Jacob Newman (CMP)
Hi Jacob,

> The problem I have is when the hardware wizard ends. The ZStage::OnPort
> method seems to run twice (I made it write to the serial port so I could see
> which methods were getting executed) and then MMCore crashes.

Could you send us your CoreLog.txt file (in the Micro-Manager
directory) and also email us the crash report file, if there is one
(it should also be in the Micro-Manager
directory and have a file with a name like hs_err_pid[####].log).

You may find it useful to compile your device in debug mode using
Visual Studio, and then place breakpoints at the beginning of various
functions and step through the code to see what line causes a crash.
When you initially run Micro-Manager, you will need to tell Visual
Studio to "attach" its debugger to the Micro-Manager process.

> I wondered if
> it was my hacked code for the methods for getting and setting the position
> of the stage, but they don't even seem to get executed. Is it possible I am
> setting properties that my device does not have? A z-stage seems to control
> focus, and obviously a stage which rotates around the z-axis, does not.

The hardware configuration wizard will only set properties that exist,
so I don't think that is likely the cause of the crash. More likely is
that there is a bug in your code causing an illegal memory access or
null pointer.

Best regards,
Arthur

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Building Micro-Manager Device Adapters

Jacob Newman (CMP)
Hi Arthur,

Thanks for getting back to me.

I've attached the CoreLog file, but there is no hs_err_pid file as far as I can see.

The log file says that the device has been sent an unsupported device command. In case it makes any difference, I'm using a serial to USB converter, instead of a direct serial cable connection.

I've also stepped through the code in Visual Studio and the last line that runs is the GetName method, which appears to work.  javaw.exe then throws a buffer overrun error.

Thanks,

Jake



On 6 Jan 2012, at 17:18, Arthur D. Edelstein wrote:

> Hi Jacob,
>
>> The problem I have is when the hardware wizard ends. The ZStage::OnPort
>> method seems to run twice (I made it write to the serial port so I could see
>> which methods were getting executed) and then MMCore crashes.
>
> Could you send us your CoreLog.txt file (in the Micro-Manager
> directory) and also email us the crash report file, if there is one
> (it should also be in the Micro-Manager
> directory and have a file with a name like hs_err_pid[####].log).
>
> You may find it useful to compile your device in debug mode using
> Visual Studio, and then place breakpoints at the beginning of various
> functions and step through the code to see what line causes a crash.
> When you initially run Micro-Manager, you will need to tell Visual
> Studio to "attach" its debugger to the Micro-Manager process.
>
>> I wondered if
>> it was my hacked code for the methods for getting and setting the position
>> of the stage, but they don't even seem to get executed. Is it possible I am
>> setting properties that my device does not have? A z-stage seems to control
>> focus, and obviously a stage which rotates around the z-axis, does not.
>
> The hardware configuration wizard will only set properties that exist,
> so I don't think that is likely the cause of the crash. More likely is
> that there is a bug in your code causing an illegal memory access or
> null pointer.
>
> Best regards,
> Arthur
>
> ------------------------------------------------------------------------------
> Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
> infrastructure or vast IT resources to deliver seamless, secure access to
> virtual desktops. With this all-in-one solution, easily deploy virtual
> desktops for less than the cost of PCs and save 60% on VDI infrastructure
> costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
> _______________________________________________
> micro-manager-general mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/micro-manager-general


------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
micro-manager-general mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/micro-manager-general

CoreLog20120110.txt (22K) Download Attachment
Loading...