[Bug 548] New: Comedi Analog Out does not work anymore
| Submitted by Ruben Smits on Tue, 2008-05-13 15:25. |
For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
Summary: Comedi Analog Out does not work anymore
Product: OCL
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Hardware
AssignedTo: orocos-dev [..]
ReportedBy: ruben smits [..]
CC: orocos-dev [..]
Estimated Hours: 0.0
Hi,
i'm experiencing some problems with my comedi analog out device (recent
problems due to ocl code change),
i checked the svn log of ComediSubDeviceAOut.cpp and saw a lot of changes which
are apparently only compile-checked, so for now i think these changes are the
reason for my problem. Can someone give me some explanation about these changes
so i can try to resolve this bug.
Ruben

[Bug 548] Comedi Analog Out does not work anymore
For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
Peter Soetens <peter soetens [..] > changed:
What |Removed |Added -------------------------------------------------------------------------- CC| |peter soetens [..]--- Comment #1 from Peter Soetens <peter soetens [..] > 2008-05-13 17:45:37 ---(In reply to comment #0)
> Hi,
>
> i'm experiencing some problems with my comedi analog out device (recent
> problems due to ocl code change),
>
> i checked the svn log of ComediSubDeviceAOut.cpp and saw a lot of changes which
> are apparently only compile-checked, so for now i think these changes are the
> reason for my problem. Can someone give me some explanation about these changes
> so i can try to resolve this bug.
They were discussed in bug report #488. You can check the attached patches for
any causes.
[Bug 548] Comedi Analog Out does not work anymore
For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
--- Comment #2 from Peter Soetens <peter soetens [..] > 2008-05-13 17:49:53 ---(In reply to comment #0)
> Hi,
>
> i'm experiencing some problems with my comedi analog out device (recent
> problems due to ocl code change),
If you want people to help out, you could also provide some details, like what
'some problems' are and which functions you are calling.
Peter
[Bug 548] Comedi Analog Out does not work anymore
For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
Peter Soetens <peter soetens [..] > changed:
What |Removed |Added -------------------------------------------------------------------------- Status|NEW |ASSIGNED Target Milestone|--- |1.6.0--- Comment #3 from Peter Soetens <peter soetens [..] > 2008-05-13 22:47:43 ---(In reply to comment #0)
> Hi,
>
> i'm experiencing some problems with my comedi analog out device (recent
> problems due to ocl code change),
>
> i checked the svn log of ComediSubDeviceAOut.cpp and saw a lot of changes which
> are apparently only compile-checked, so for now i think these changes are the
> reason for my problem. Can someone give me some explanation about these changes
> so i can try to resolve this bug.
I'll commit this fix to trunk:
TeX Embedding failed! svn ci hardware/comedi/dev/ComediSubDeviceAIn.cpp
hardware/comedi/dev/ComediSubDeviceAOut.cpp -m"Fix for bug #548: Comedi Analog
Out does not work anymore
> Initialise the range calculation.
> "
Sending hardware/comedi/dev/ComediSubDeviceAIn.cpp
Sending hardware/comedi/dev/ComediSubDeviceAOut.cpp
Transmitting file data ..
Committed revision 29275.
[Bug 548] Comedi Analog Out does not work anymore
For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
--- Comment #4 from Ruben Smits <ruben smits [..] > 2008-05-14 11:43:30 ---It is still not completely fixed,
if i ask a value of 0.0, the ComediSubDevAOut still sends -10V
if i ask a value of 1.0 the voltage increases, increasing the value makes the
voltage go through zero to its maximum voltage and then goes back to -10V,
still not the desired behaviour.
Ruben
[Bug 548] Comedi Analog Out does not work anymore
For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
--- Comment #5 from Ruben Smits <ruben smits [..] > 2008-05-14 12:07:55 ---After adding some log messages i get the following:
resolution(0)=204.75
min[0]=-10
max[0]=10
unsigned int value = (unsigned int)(dvalue * resolution(chan) - minchan);
value should be 2048 if dvalue is 0.0, this equation results in (uint)(10)
which is completely wrong, my guess would be that the equation should look
something like this:
unsigned int value = (unsigned int)((dvalue + maxchan)*resolution)
value is 0 if dvalue = -10
value is 2048 if dvalue = 0.0
value is 4096 if dvalue = 10
i do not know yet what value should become if dvalue exceeds max or min.
Ruben
[Bug 548] Comedi Analog Out does not work anymore
For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
--- Comment #6 from Peter Soetens <peter soetens [..] > 2008-05-14 13:10:12 ---I can't believe I wrote this...
TeX Embedding failed! svn ci ComediSubDeviceAOut.cpp -m"Fix for bug #548: Comedi Analog Out does
not work anymore.
> correct double->int conversion.
> "
Sending ComediSubDeviceAOut.cpp
Transmitting file data .
Committed revision 29276.
[Bug 548] Comedi Analog Out does not work anymore
On Wednesday May 14 2008 13:10:12 Peter Soetens wrote:
> For more infomation about this bug, visit
> <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
>
>
>
> --- Comment #6 from Peter Soetens <peter soetens [..] > 2008-05-14
> 13:10:12 --- I can't believe I wrote this...
>
> $ svn di ComediSubDeviceAOut.cpp
> Index: ComediSubDeviceAOut.cpp
> ===================================================================
> --- ComediSubDeviceAOut.cpp (revision 29275)
> +++ ComediSubDeviceAOut.cpp (working copy)
> @@ -137,7 +137,7 @@
>
> int ComediSubDeviceAOut::write( unsigned int chan, double dvalue )
> {
> - unsigned int value = (unsigned int)(dvalue * resolution(chan) -
> minchan);
> + unsigned int value = (unsigned int)(dvalue - minchan) *
> resolution(chan);
it should be:
(unsigned int)((dvalue + maxchan)*resolution)or
(unsigned int)((dvalue - minchan)*resolution)because resolution is also a double, or am i completely wrong here?
Ruben
[Bug 548] Comedi Analog Out does not work anymore
For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
--- Comment #7 from Ruben Smits <ruben smits [..] > 2008-05-14 13:11:39 ---Created an attachment (id=289)
fixes comediAOut write function
This patch works perfectly for me.
Ruben
[Bug 548] Comedi Analog Out does not work anymore
For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
Peter Soetens <peter soetens [..] > changed:
What |Removed |Added -------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED--- Comment #8 from Peter Soetens <peter soetens [..] > 2008-05-14 13:24:46 ---(In reply to comment #7)
> Created an attachment (id=289)
> fixes comediAOut write function
>
> This patch works perfectly for me.
You should use -minchan instead of +maxchan. This is because your device
could be 0 -> 10V, (0->4096) in which case, your rule will be wrong.
The min/max check is indeed necessary. I'll commit that part.
Peter
[Bug 548] Comedi Analog Out does not work anymore
On Wednesday May 14 2008 13:24:46 Peter Soetens wrote:
> For more infomation about this bug, visit
> <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
>
> Peter Soetens <peter soetens [..] > changed:
>
> What |Removed |Added
> --------------------------------------------------------------------------
> Status|ASSIGNED |RESOLVED
> Resolution| |FIXED
>
>
>
> --- Comment #8 from Peter Soetens <peter soetens [..] > 2008-05-14
> 13:24:46 --- (In reply to comment #7)
>
> > Created an attachment (id=289)
>
> --> (https://www.fmtc.be/bugzilla/orocos/attachment.cgi?id=289) details
>
> > fixes comediAOut write function
> >
> > This patch works perfectly for me.
>
> You should use -minchan instead of +maxchan. This is because your
> device could be 0 -> 10V, (0->4096) in which case, your rule will be wrong.
>
> The min/max check is indeed necessary. I'll commit that part.
Ok, thanks. Our robot will be pleased to be able to move slow again ;)
Ruben
[Bug 548] Comedi Analog Out does not work anymore
For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=548>
--- Comment #9 from Peter Soetens <peter soetens [..] > 2008-05-14 13:48:45 ---This patch also checks ranges:
TeX Embedding failed! svn ci ComediSubDeviceAOut.cpp -m"Fix for bug #548: Comedi Analog Out does
not work anymore.
Check ranges of function arguments.
> "
Sending ComediSubDeviceAOut.cpp
Transmitting file data .
Committed revision 29277.