Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridge 4 Input Support #83

Open
ChristianMarzi opened this issue Mar 7, 2021 · 2 comments
Open

Bridge 4 Input Support #83

ChristianMarzi opened this issue Mar 7, 2021 · 2 comments

Comments

@ChristianMarzi
Copy link

Hi
this is a copy of my post on ROS answers, but i think here might be a better place to ask:

im trying to get the data from the PhidgetBridge 4-Input into ros noetic (e.g. publishing the sensor values on a topic). As far as i've understood this device is not supported yet. Is that correct or could i reuse one of the existing packes in phidgets_drivers? Maybe with minor modification?

So far i've tried using the analog input nodelet roslaunch phidgets_analog_inputs analog_inputs.launch(pulled and built the noetic branch) however i got the connection problem: [ERROR] [1614854548.863487183]: AnalogInputs: Failed to open device: Timed Out(device is pluged in usb port an visible in /dev)

If unsupported, i'm willing to try to contribute, however as i've never done anything alike i would appriciate any reccomendation or help on what steps to take?

@mintar
Copy link
Contributor

mintar commented Mar 8, 2021

The phidgets_analog_inputs package was written with the PhidgetInterfaceKit 8/8/8 or PhidgetInterfaceKit 2/2/2 in mind, but I believe you should be able to make it work for the PhidgetBridge as well with some minimal changes.

I believe the main change is here:

ret = Phidget_getDeviceChannelCount(handle, PHIDCHCLASS_VOLTAGEINPUT,
&input_count_);

In this line, we're trying to open a device with ChannelClass PHIDCHCLASS_VOLTAGEINPUT. According to the API, the PhidgetBridge has a ChannelClass of PHIDCHCLASS_VOLTAGERATIOINPUT instead. This is because the Bridge doesn't provide analog inputs, but instead voltage ratio inputs.

It's probably best if you look at the following files:

phidgets_api/include/phidgets_api/analog_input.h
phidgets_api/include/phidgets_api/analog_inputs.h
phidgets_api/src/analog_input.cpp
phidgets_api/src/analog_inputs.cpp
phidgets_analog_inputs/*

Then copy all *analog_input* to something new, like *voltage_ratio_input* and make the relevant changes there. I'm suggesting copying this instead of modifying it in place because "voltage ratio input" is a new kind of input that we don't yet have support for, so it shouldn't be mixed in with the analog input. There are probably some more things that need to be adjusted as well in those files.

@ChristianMarzi
Copy link
Author

Thanks for the input. I now have a working version locally. I'll clean it up and create a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants