Re: [ros-users] patch + packages for ccny_vision on natty

Top Page
Attachments:
Message as email
+ (text/plain)
+ artoolkit-svn-diff.txt (text/plain)
+ artoolkit-patch-natty-v2.txt (text/plain)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: bill, User discussions
Subject: Re: [ros-users] patch + packages for ccny_vision on natty
Alright, lets try this again. Modified patch and tar file:

git clone http://robotics.ccny.cuny.edu/git/ccny-ros-pkg/ccny_vision.git
cd ccny_vision
wget http://www.cs.utexas.edu/~piyushk/artoolkit-patch-natty-v2.txt
git apply artoolkit-patch-natty-v2.txt
rosmake ccny_vision --rosdep-install

The patched tar that will be downloaded is
http://www.cs.utexas.edu/~piyushk/ARToolKit-r311-Natty.tar.gz

I have verified that artoolkit compiles on natty (w/o
linux/videodev.h) and on lucid (w/ linux/videodev.h), so I have a good
belief that this will be backwards compatible. Since ARToolkit does
not use autoconf, I have patched patch_v4l to test for the include
file and generate a config accordingly. The svn diff for artoolkit and
the patch are attached to this email in case you wish to analyze them.

You will have to make the appropriate changes once the patched
ARToolKit is uploaded to
https://code.ros.org/svn/release/download/thirdpart

Hope this works this time around! Let me know if you face any problems.
Piyush

On Sat, Oct 8, 2011 at 5:59 PM, Piyush <> wrote:
> This is correct - the patch was only for Natty. For some weird reason
> I assumed that the debs could be built externally without pushing this
> change to the repository. It was a bad idea in the first place.
>
> I will see if I can work on this later tonight - the patch is still
> relatively easy based on what Bill suggests, and will require
> modifying ARToolKit's custom configuration script to provide the
> LIBV4L1 flag as necessary.
>
> Piyush
>
> On Sat, Oct 8, 2011 at 1:14 PM, Bill Morris <> wrote:
>> Looking at the SED code
>> $ roscd artoolkit
>> $ sed -i 's,#include <linux/videodev.h>,#include <libv4l1-videodev.h>,g' ./build/artoolkit/include/AR/sys/videoLinuxV4L.h
>> $ sed -i 's,#include <linux/videodev.h>,#include <libv4l1-videodev.h>,g' ./build/artoolkit/lib/SRC/VideoLinuxV4L/video.c
>>
>> It is clear that this patch will break previous version.
>>
>> You need something like ifdefs
>>
>> #ifdef LIBV4L1
>>  #include <libv4l1-videodev.h>
>> #else
>>  #include <linux/videodev.h>
>> #endif
>>
>>
>> I built the previous patched artoolkit.
>> You need to be added to the thirdparty group on code.ros.org
>> https://code.ros.org/svn/release/download/thirdparty
>>
>>
>> On Fri, 2011-10-07 at 17:47 -0400, Carlos J. wrote:
>>> Piyush,
>>>
>>> Thanks for patching ARToolKit, However we have a concern: will this
>>> modifications you've made to the v4l header affect other Ubuntu
>>> distributions prior to Natty? In other words, before we make the patch
>>> official, we must ensure that the patch will not affect other users
>>> who run older Ubuntu distros.
>>>
>>> If that's the case, we will ask Ken from WG to upload the patched
>>> ARToolKit to the download server at code.ros.org
>>>
>>> Carlos
>>>
>>> On Tue, Oct 4, 2011 at 1:26 PM, Piyush Khandelwal <> wrote:
>>> > Hi,
>>> >
>>> > Currently ccny_vision has no packages for natty as it does not build
>>> > without a patch. See: http://robotics.ccny.cuny.edu/trac/ticket/55
>>> > Instructions for manually patching are available here:
>>> > http://www.ros.org/wiki/artoolkit
>>> >
>>> > I have a patch available at
>>> > http://www.cs.utexas.edu/~piyushk/artoolkit-patch-natty.txt which
>>> > automates the procedure above. i.e I can run this on any of my
>>> > machines using the following commands:
>>> >
>>> > git clone http://robotics.ccny.cuny.edu/git/ccny-ros-pkg/ccny_vision.git
>>> > cd ccny_vision
>>> > wget http://www.cs.utexas.edu/~piyushk/artoolkit-patch-natty.txt
>>> > git apply artoolkit-patch-natty.txt
>>> > rosmake ccny_vision --rosdep-install
>>> >
>>> > Note: The tar downloaded will be
>>> > http://www.cs.utexas.edu/~piyushk/ARToolKit-Natty.tar.gz. This has
>>> > been patched.
>>> >
>>> > Is anybody from WG or CCNY interested in a more permanent fix to the
>>> > problem, i.e. releasing packages for easier use. I am unfamiliar with
>>> > the build process for releasing debs, so I am not sure how much work
>>> > this entails.
>>> >
>>> > Thanks!
>>> > Piyush
>>> > _______________________________________________
>>> > ros-users mailing list
>>> >
>>> > https://code.ros.org/mailman/listinfo/ros-users
>>> >
>>> _______________________________________________
>>> ros-users mailing list
>>>
>>> https://code.ros.org/mailman/listinfo/ros-users
>>
>> --
>> Bill Morris <>
>> I Heart Engineering
>> http://www.iheartengineering.com
>> <3
>>
>> _______________________________________________
>> ros-users mailing list
>>
>> https://code.ros.org/mailman/listinfo/ros-users
>>
>

Index: include/AR/sys/videoLinuxV4L.h
===================================================================
--- include/AR/sys/videoLinuxV4L.h    (revision 311)
+++ include/AR/sys/videoLinuxV4L.h    (working copy)
@@ -21,7 +21,13 @@


#include <stdlib.h>
#include <linux/types.h>
-#include <linux/videodev.h>
+
+#include <AR/v4l-config.h>
+#ifndef HAVE_CAMV4L
+ #include <libv4l1-videodev.h>
+#else
+ #include <linux/videodev.h>
+#endif

 #include <AR/config.h>
 #include <AR/ar.h>
Index: include/AR/sys/videoLinux1394Cam.h
===================================================================
--- include/AR/sys/videoLinux1394Cam.h    (revision 311)
+++ include/AR/sys/videoLinux1394Cam.h    (working copy)
@@ -19,7 +19,14 @@


#include <stdlib.h>
#include <linux/types.h>
-#include <linux/videodev.h>
+
+#include <AR/v4l-config.h>
+#ifndef HAVE_CAMV4L
+ #include <libv4l1-videodev.h>
+#else
+ #include <linux/videodev.h>
+#endif
+
#include <libraw1394/raw1394.h>
#include <libdc1394/dc1394_control.h>

Index: lib/SRC/VideoLinuxV4L/video.c
===================================================================
--- lib/SRC/VideoLinuxV4L/video.c    (revision 311)
+++ lib/SRC/VideoLinuxV4L/video.c    (working copy)
@@ -27,7 +27,14 @@
 #include <stdlib.h>
 #include <string.h>
 #include <linux/types.h>
-#include <linux/videodev.h>
+
+#include <AR/v4l-config.h>
+#ifndef HAVE_CAMV4L
+  #include <libv4l1-videodev.h>
+#else
+  #include <linux/videodev.h>
+#endif
+
 #include <AR/config.h>
 #include <AR/ar.h>
 #include <AR/video.h>


commit ab052576b4a35e40feced46fd52452b10ed95aad
Author: Piyush Khandelwal <piyushk@piyushk-desktop.(none)>
Date: Sat Oct 8 16:20:56 2011 -0500

    patch for natty


diff --git a/artoolkit/ARToolKit-SVN-r311.tar.gz.md5sum b/artoolkit/ARToolKit-SVN-r311.tar.gz.md5sum
deleted file mode 100644
index a8d3e4c..0000000
--- a/artoolkit/ARToolKit-SVN-r311.tar.gz.md5sum
+++ /dev/null
@@ -1 +0,0 @@
-2f3537f782b5506133bcc79f2daba3bb ARToolKit-SVN-r311.tar.gz
diff --git a/artoolkit/ARToolKit-r311-Natty.tar.gz.md5sum b/artoolkit/ARToolKit-r311-Natty.tar.gz.md5sum
new file mode 100644
index 0000000..de3cf95
--- /dev/null
+++ b/artoolkit/ARToolKit-r311-Natty.tar.gz.md5sum
@@ -0,0 +1 @@
+309ed9213c6d12871faeed781b0c5d82 ARToolKit-r311-Natty.tar.gz
diff --git a/artoolkit/Makefile b/artoolkit/Makefile
index 593fded..5645476 100755
--- a/artoolkit/Makefile
+++ b/artoolkit/Makefile
@@ -1,11 +1,11 @@
all: installed

-TARBALL     = build/ARToolKit-SVN-r311.tar.gz
-TARBALL_URL = https://code.ros.org/svn/release/download/thirdparty/ARToolKit-SVN-r311.tar.gz
+TARBALL     = build/ARToolKit-r311-Natty.tar.gz
+TARBALL_URL = http://www.cs.utexas.edu/~piyushk/ARToolKit-r311-Natty.tar.gz
 UNPACK_CMD  = tar zxf
 SOURCE_DIR  = build/artoolkit
 #TARBALL_PATCH = matrix.patch
-MD5SUM_FILE = ARToolKit-SVN-r311.tar.gz.md5sum
+MD5SUM_FILE = ARToolKit-r311-Natty.tar.gz.md5sum


include $(shell rospack find mk)/download_unpack_build.mk

diff --git a/artoolkit/patch_v4l b/artoolkit/patch_v4l
index 9fcd82d..d91ac25 100755
--- a/artoolkit/patch_v4l
+++ b/artoolkit/patch_v4l
@@ -294,3 +294,20 @@ echo " create include/AR/config.h"
sed -f $SED <include/AR/config.h.in > include/AR/config.h

echo "Done."
+
+#
+# Output step 3 - Test for v4l1
+# Figure out if linux/videodev.h
+#
+
+cat > .test.h << EOM
+#include <linux/videodev.h>
+EOM
+if gcc -E .test.h
+then
+ echo '#define HAVE_CAMV4L 1' > include/AR/v4l-config.h
+else
+ echo '#ifdef HAVE_CAMV4L' > include/AR/v4l-config.h
+ echo ' #undef HAVE_CAMV4L' >> include/AR/v4l-config.h
+ echo '#endif' >> include/AR/v4l-config.h
+fi