Revision: 8227
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8227&view=rev
Author:   gbiggs
Date:     2009-08-26 08:19:56 +0000 (Wed, 26 Aug 2009)

Log Message:
-----------
Fixed missing dependencies for Python and Ruby bindings. Applied patch 
#2839013: sonyevid30 RTOD/DTOR patch

Modified Paths:
--------------
    code/player/trunk/client_libs/libplayerc/bindings/python/CMakeLists.txt
    code/player/trunk/client_libs/libplayerc/bindings/ruby/CMakeLists.txt
    code/player/trunk/server/drivers/ptz/sonyevid30.cc

Modified: 
code/player/trunk/client_libs/libplayerc/bindings/python/CMakeLists.txt
===================================================================
--- code/player/trunk/client_libs/libplayerc/bindings/python/CMakeLists.txt     
2009-08-26 06:09:46 UTC (rev 8226)
+++ code/player/trunk/client_libs/libplayerc/bindings/python/CMakeLists.txt     
2009-08-26 08:19:56 UTC (rev 8227)
@@ -36,6 +36,8 @@
             # Copy playerc.i to the build directory
             SET (playerc_i "${CMAKE_CURRENT_SOURCE_DIR}/playerc.i")
 
+            SET (SWIG_MODULE_playerc_EXTRA_DEPS 
${PROJECT_SOURCE_DIR}/client_libs/libplayerc/playerc.h
+                                                
${PROJECT_BINARY_DIR}/libplayerinterface/player_interfaces.h)
             SWIG_ADD_MODULE (playerc python ${playerc_i})
             SWIG_LINK_LIBRARIES (playerc ${PYTHON_LIBRARIES})
             ADD_DEPENDENCIES (${SWIG_MODULE_playerc_REAL_NAME} 
playerc_wrap_i_target)

Modified: code/player/trunk/client_libs/libplayerc/bindings/ruby/CMakeLists.txt
===================================================================
--- code/player/trunk/client_libs/libplayerc/bindings/ruby/CMakeLists.txt       
2009-08-26 06:09:46 UTC (rev 8226)
+++ code/player/trunk/client_libs/libplayerc/bindings/ruby/CMakeLists.txt       
2009-08-26 08:19:56 UTC (rev 8227)
@@ -42,6 +42,8 @@
             #If playercr is called simply playerc, all sorts of errors happen
             #I guess is namespace conflict with Python bindings' playerc
             #currently we create playercr locally but install it as playerc 
+            SET (SWIG_MODULE_playercr_EXTRA_DEPS 
${PROJECT_SOURCE_DIR}/client_libs/libplayerc/playerc.h
+                                                 
${PROJECT_BINARY_DIR}/libplayerinterface/player_interfaces.h)
             SWIG_ADD_MODULE (playercr ruby ${playerc_i})
             SWIG_LINK_LIBRARIES (playercr ${RUBY_LIBRARY})
             ADD_DEPENDENCIES (${SWIG_MODULE_playercr_REAL_NAME} 
playerc_wrap_i_target)

Modified: code/player/trunk/server/drivers/ptz/sonyevid30.cc
===================================================================
--- code/player/trunk/server/drivers/ptz/sonyevid30.cc  2009-08-26 06:09:46 UTC 
(rev 8226)
+++ code/player/trunk/server/drivers/ptz/sonyevid30.cc  2009-08-26 08:19:56 UTC 
(rev 8227)
@@ -108,6 +108,7 @@
 #include "config.h"
 
 #include <fcntl.h>
+#include <stddef.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
@@ -116,6 +117,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <math.h>
+#include <time.h>
 
 #include <libplayercore/playercore.h>
 #include <replace/replace.h>
@@ -143,6 +145,22 @@
 #define VISCA_COMMAND_CODE     0x01
 #define VISCA_INQUIRY_CODE     0x09
 
+#ifndef M_PI
+#define M_PI           3.14159265358979323846
+#endif
+
+// Convert degrees to radians
+#ifndef DTOR
+#define DTOR(d) ((static_cast<double>(d)) * (M_PI) / 180.0)
+#endif
+
+// Convert radians to degrees
+#ifndef RTOD
+#define        RTOD(r) ((static_cast<double>(r)) * 180.0 / M_PI)
+#endif
+
+#define EPS 0.0000001
+
 /*
  *
  *
@@ -198,14 +216,22 @@
 
 float evid_cam_pan_radians(evid_cam_t cam, short pan_cu)
 {
+/*
        float conv_factor = -cam.pan_max_rad / cam.pan_max_cu;
        return pan_cu * conv_factor;
+*/
+        cam = cam;
+        return DTOR(-pan_cu);
 }
 
 float evid_cam_tilt_radians(evid_cam_t cam, short tilt_cu)
 {
+/*
        float conv_factor = cam.tilt_max_rad / cam.tilt_max_cu;
        return tilt_cu * conv_factor;
+*/
+        cam = cam;
+        return DTOR(tilt_cu);
 }
 
 float evid_cam_panspeed_radians(evid_cam_t cam, short panspeed_cu)
@@ -232,24 +258,35 @@
 
 float evid_cam_zoom_radians(evid_cam_t cam, short zoom_cu)
 {
+/*
        float conv_factor = (cam.fov_max_rad - cam.fov_min_rad)
                                                        / (cam.fov_max_cu - 
cam.fov_min_cu);
 
        return (zoom_cu - cam.fov_min_cu) * conv_factor + cam.fov_min_rad;
+*/
+        return DTOR(RTOD(cam.fov_max_rad) + (static_cast<double>(zoom_cu) * 
(RTOD(cam.fov_min_rad) - RTOD(cam.fov_max_rad))) / 1024.0);
 }
 
 short evid_cam_pan_cu(evid_cam_t cam, float pan_radians)
 {
+/*
        float conv_factor = -cam.pan_max_cu / cam.pan_max_rad;
        pan_radians = clip_float(pan_radians, -cam.pan_max_rad, 
cam.pan_max_rad);
        return (short) rint(pan_radians * conv_factor);
+*/
+        cam = cam;
+        return static_cast<short>(-(RTOD(pan_radians)));
 }
 
 short evid_cam_tilt_cu(evid_cam_t cam, float tilt_radians)
 {
+/*
        float conv_factor = cam.tilt_max_cu / cam.tilt_max_rad;
        tilt_radians = clip_float(tilt_radians, cam.tilt_min_rad, 
cam.tilt_max_rad);
        return (short) rint(tilt_radians * conv_factor);
+*/
+       cam = cam;
+       return static_cast<short>(RTOD(tilt_radians));
 }
 
 /*
@@ -314,6 +351,7 @@
  */
 short evid_cam_zoom_cu(evid_cam_t cam, float zoom_radians)
 {
+/*
        float conv_factor = (cam.fov_max_cu - cam.fov_min_cu)
                                                        / (cam.fov_max_rad - 
cam.fov_min_rad);
        if (zoom_radians == 0) {
@@ -323,6 +361,9 @@
                return (short) ((zoom_radians - cam.fov_min_rad) * conv_factor
                                        + cam.fov_min_cu);
        }
+*/
+        if (fabs(zoom_radians) < EPS) zoom_radians = cam.fov_max_rad;
+        return (1024 * (static_cast<short>(RTOD(zoom_radians)) - 
static_cast<short>(RTOD(cam.fov_max_rad)))) / 
(static_cast<short>(RTOD(cam.fov_min_rad)) - 
static_cast<short>(RTOD(cam.fov_max_rad)));
 }
 
 /*
@@ -705,9 +746,9 @@
 
   // put the camera back to center
   usleep(PTZ_SLEEP_TIME_USEC);
-  SendAbsPanTilt(0,0);
+  SendAbsPanTilt(evid_cam_pan_cu(this->cam_config_, 0.0), 
evid_cam_tilt_cu(this->cam_config_, 0.0));
   usleep(PTZ_SLEEP_TIME_USEC);
-       SendAbsZoom(cam_config_.fov_max_cu);
+  SendAbsZoom(evid_cam_zoom_cu(this->cam_config_, 0.0));
 
   if(close(ptz_fd))
     perror("SonyEVID30::Shutdown():close():");
@@ -1201,12 +1242,12 @@
                        cam_config_ = SONY_EVI_CAMERAS[0];
                }
 
-               if (maxfov != 0) {
-                       cam_config_.fov_max_rad = maxfov;
+               if (!(fabs(this->maxfov) < EPS)) {
+                       this->cam_config_.fov_max_rad = this->maxfov;
+                }
+               if (!(fabs(this->minfov) < EPS)) {
+                       this->cam_config_.fov_min_rad = this->minfov;
                }
-               if (minfov != 0) {
-                       cam_config_.fov_min_rad = minfov;
-               }
        }
        return 0;
 }
@@ -1297,7 +1338,7 @@
        switch (control_mode_) {
        case PLAYER_PTZ_VELOCITY_CONTROL:
                // Change of velocity requested?
-               if (cmd->panspeed != panspeed_demand_rad
+                if (cmd->panspeed != panspeed_demand_rad
                || cmd->tiltspeed != tiltspeed_demand_rad) {
                        panspeed_demand_rad = cmd->panspeed;
                        tiltspeed_demand_rad = cmd->tiltspeed;
@@ -1497,6 +1538,7 @@
 {
        while (1) {
     player_ptz_data_t data;
+    struct timespec ts;
 
     // Process incoming requests
     pthread_testcancel();
@@ -1514,7 +1556,9 @@
     pthread_testcancel();
     Publish(device_addr, PLAYER_MSGTYPE_DATA, PLAYER_PTZ_DATA_STATE, 
&data,sizeof(player_ptz_data_t),NULL);
 
-    usleep(PTZ_SLEEP_TIME_USEC);
+    ts.tv_sec = 0;
+    ts.tv_nsec = PTZ_SLEEP_TIME_USEC * 1000;
+    nanosleep(&ts, NULL);
     }
 }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to