Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Using the same U12 from multiple programms/tasks

multiple usages programms

  • Please log in to reply
5 replies to this topic

#1 eggerph

eggerph
  • Members
  • 4 posts

Posted 31 October 2013 - 09:27 AM

Hi,

I am trying to use the U12 in order to read and input data from a robot. I programmed in C++ using ROS. With ROS I have many different tasks, services... And multiple tasks/programms should be able to apply changes to the U12 and read Data from it. However now it seems that whenever a new part of the software communicates with the U12 it is somehow reinitialized and channels (I'm currently working with Digital ports). I have so far only been working with the Easy Functions. How can I prevent the U12 from doing so? Is it maybe possible with the DigitalIO function?

Just to add: also reading from analog input ports clears all digital states to 0.

For any help thanks in advance!

 



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 31 October 2013 - 10:00 AM

Are you using our ljackuw.dll for Windows?  Is ROS some sort of layer on top of Windows?

 

The low-level functions operate on lots of I/O at the same time, so when an easy function wants to control a single output it has to know prior state of other I/O so it can send those same values and thus not change them.  The diver attempts to do that, but if you have multiple processes it could get confused.  Using the non-efunctions would avoid that issue.  AISample and AOUpdate together do almost everything on the U12.



#3 eggerph

eggerph
  • Members
  • 4 posts

Posted 04 November 2013 - 12:45 AM

 

ROS (Robot Operating System) provides libraries and tools to help software developers create robot applications. It provides hardware abstraction, device drivers, libraries, visualizers, message-passing, package management, and more. ROS is licensed under an open source, BSD license.

Source: wiki.ros.org

I'm using multiple processes because I am only working with labjack in an early stage. Later I will have motor drivers and other connections to which I need to connect.

I am working on ubuntu and use the Linux library.

With the non-efunctions I would need to pass the states at at every call, right? ROS does provide a parameter server where I could save all states in order to pass them in every function call, but I would rather not do so. Seems to me like a lot of work and also dangerous: I can not allow loosing a "on" state.  Any other suggestions?



#4 eggerph

eggerph
  • Members
  • 4 posts

Posted 04 November 2013 - 09:41 AM

short update: calling EAnalogIn does not seem to reinitialize all the states, which of course makes sense. I now have thrown all the control via the U12 in a new process and am communicating with this process. It's a workaround and not as nice as it could be but still better/more reliable than having to save all states in a parameter server. Any other suggestions are still much appreciated.



#5 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 04 November 2013 - 09:59 AM

1.  Use any other LabJack besides the U12.  All other LabJacks (U3/U6/UE9/T7) are newer and have actual low-level calls that can update one output at a time.

 

2.  Rather than using EDigitalIn and EDigitalOut, make your own functions that each make 2 calls to DigitalIO.  Can you fix each digital line as output or input and always keep them that way, or do you need to change some lines back-and-forth between input and output?  Can you just use D lines, or do you have to use IO lines?



#6 eggerph

eggerph
  • Members
  • 4 posts

Posted 12 November 2013 - 04:36 AM

I moved now all Labjack communication in one process. Everything seemed to me to much of a mess. But thank you very much for the help. It's working now.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users