changeset 279:72404fe54741 main tip

Merge from upstream.
author Bob Cook <bob@bobcookdev.com>
date Mon, 30 May 2016 19:04:39 -0700
parents f2546f8b4ba7 (diff) acdf982637fc (current diff)
children
files main/packages/avr/lcd/.DS_Store main/packages/common/.DS_Store
diffstat 11 files changed, 231 insertions(+), 360 deletions(-) [+]
line wrap: on
line diff
--- a/main/packages/common/can/can_messages.h	Mon May 02 19:43:34 2016 -0700
+++ b/main/packages/common/can/can_messages.h	Mon May 30 19:04:39 2016 -0700
@@ -7,7 +7,7 @@
 // 
 //  Identifiers for Controller Area Network messages.
 //
-//  Copyright (c) 2010-2015 Bob Cook
+//  Copyright (c) 2010-2016 Bob Cook
 //
 //  Permission is hereby granted, free of charge, to any person obtaining a copy
 //  of this software and associated documentation files (the "Software"), to deal
@@ -47,6 +47,7 @@
 //      GPS sensor:             0x0100 to 0x010f
 //      Wheels (front & rear):  0x0110 to 0x011f
 //      Sonar (front):          0x0130 to 0x013f
+//      PixyCam sensor:         0x0140 to 0x014f
 //
 // ----------------------------------------------------------------------------------------
 
@@ -243,6 +244,13 @@
 
 // ----------------------------------------------------------------------------------------
 
+const uint16_t can_dataid_pixy_start_tracking = 0x0140;
+const uint16_t can_dataid_pixy_stop_tracking  = 0x0141;
+
+const uint16_t can_dataid_pixy_grabframe = 0x0143;
+
+// ----------------------------------------------------------------------------------------
+
 #if !defined( __AVR__ )
 #pragma pack(pop)
 #endif
--- a/main/packages/common/can/can_nodes.h	Mon May 02 19:43:34 2016 -0700
+++ b/main/packages/common/can/can_nodes.h	Mon May 30 19:04:39 2016 -0700
@@ -7,7 +7,7 @@
 // 
 //  Identifiers for Controller Area Network nodes across multiple projects.
 //
-//  Copyright (c) 2011-2013 Bob Cook
+//  Copyright (c) 2011-2016 Bob Cook
 //
 //  Permission is hereby granted, free of charge, to any person obtaining a copy
 //  of this software and associated documentation files (the "Software"), to deal
@@ -52,8 +52,9 @@
 // ----------------------------------------------------------------------------------------
 //  sensor modules
 
-const uint8_t can_node_sensor_gps = 0x0030;
-const uint8_t can_node_sensor_imu = 0x0031;
+const uint8_t can_node_sensor_gps  = 0x0030;
+const uint8_t can_node_sensor_imu  = 0x0031;
+const uint8_t can_node_sensor_pixy = 0x0032;
 
 // ----------------------------------------------------------------------------------------
 #endif  // #if !defined(BCDRL_COMMON_CAN_CAN_NODES_H)
--- a/main/robots/cantool/CanToolApp.cpp	Mon May 02 19:43:34 2016 -0700
+++ b/main/robots/cantool/CanToolApp.cpp	Mon May 30 19:04:39 2016 -0700
@@ -7,7 +7,7 @@
 //
 //  Application object implementation for demonstrating the CANSocket class.    
 //
-//  Copyright (c) 2011-2014 Bob Cook
+//  Copyright (c) 2011-2016 Bob Cook
 //
 //  Permission is hereby granted, free of charge, to any person obtaining a copy
 //  of this software and associated documentation files (the "Software"), to deal
@@ -72,6 +72,7 @@
     m_commandDispatchTable[ "estop" ] = CommandEStop;
     m_commandDispatchTable[ "gps" ] = CommandGps;
     m_commandDispatchTable[ "listen" ] = CommandListen;
+    m_commandDispatchTable[ "pixy" ] = CommandPixy;
     m_commandDispatchTable[ "sonarfront" ] = CommandSonarFront;
     m_commandDispatchTable[ "speed" ] = CommandSpeed;
     m_commandDispatchTable[ "start" ] = CommandStartPgm;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main/robots/cantool/CmdPixy.cpp	Mon May 30 19:04:39 2016 -0700
@@ -0,0 +1,122 @@
+// ----------------------------------------------------------------------------------------
+//
+//  robots/cantool/CmdPixy.cpp
+//    
+//  Bob Cook Development, Robotics Library
+//  http://www.bobcookdev.com/rl/
+//
+//  Command "pixy" implementation.
+//
+//  Copyright (c) 2016 Bob Cook
+//
+//  Permission is hereby granted, free of charge, to any person obtaining a copy
+//  of this software and associated documentation files (the "Software"), to deal
+//  in the Software without restriction, including without limitation the rights
+//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+//  copies of the Software, and to permit persons to whom the Software is
+//  furnished to do so, subject to the following conditions:
+//
+//  The above copyright notice and this permission notice shall be included in
+//  all copies or substantial portions of the Software.
+//
+//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+//  THE SOFTWARE.
+//
+// ----------------------------------------------------------------------------------------
+
+#include <iostream>
+
+#include <Poco/Exception.h>
+#include <Poco/NumberFormatter.h>
+#include <Poco/NumberParser.h>
+
+#include "Commands.h"
+
+#include "packages/common/can/can_helpers.h"
+#include "packages/common/can/can_messages.h"
+#include "packages/common/can/can_nodes.h"
+
+#include "packages/linux/can/CANMessage.h"
+#include "packages/linux/can/CANMsgProcessor.h"
+
+// ----------------------------------------------------------------------------------------
+
+static void PrintHelp()
+{
+    std::cerr << "error: pixy [ track | off | grab ]" << std::endl;
+}
+
+// ----------------------------------------------------------------------------------------
+
+static void sendTrackMessage()
+{
+    uint32_t msgid = can_build_message_id( can_node_odr_manager,
+                                           can_node_odr_motion,
+                                           can_dataid_pixy_start_tracking );
+
+    CANMessage::QueueToSend( new CANMessage( msgid ) );
+
+    std::cout << "pixy tracking on" << std::endl;
+}
+
+// ----------------------------------------------------------------------------------------
+
+static void sendOffMessage()
+{
+    uint32_t msgid = can_build_message_id( can_node_odr_manager,
+                                           can_node_odr_motion,
+                                           can_dataid_pixy_stop_tracking );
+
+    CANMessage::QueueToSend( new CANMessage( msgid ) );
+
+    std::cout << "pixy tracking off" << std::endl;
+}
+
+// ----------------------------------------------------------------------------------------
+
+static void sendGrabFrameMessage()
+{
+    uint32_t msgid = can_build_message_id( can_node_odr_manager,
+                                           can_node_odr_motion,
+                                           can_dataid_pixy_grabframe );
+
+    CANMessage::QueueToSend( new CANMessage( msgid ) );
+
+    std::cout << "pixy grab frame" << std::endl;
+}
+
+// ----------------------------------------------------------------------------------------
+
+void CommandPixy( const std::vector< std::string >& args )
+{
+    if ( args.size() != 2 )
+    {
+        PrintHelp();
+        return;
+    }
+
+    if ( args[ 2 ] == "track" )
+    {
+        sendTrackMessage();
+    }
+    else if ( args[ 2 ] == "off" )
+    {
+        sendOffMessage();
+    }
+    else if ( args[ 2 ] == "grab" )
+    {
+        sendGrabFrameMessage();
+    }
+    else
+    {
+        PrintHelp();
+    }
+}
+
+// ----------------------------------------------------------------------------------------
+
--- a/main/robots/cantool/Commands.h	Mon May 02 19:43:34 2016 -0700
+++ b/main/robots/cantool/Commands.h	Mon May 30 19:04:39 2016 -0700
@@ -7,7 +7,7 @@
 //
 //  Command function prototypes.
 //
-//  Copyright (c) 2011-2014 Bob Cook
+//  Copyright (c) 2011-2016 Bob Cook
 //
 //  Permission is hereby granted, free of charge, to any person obtaining a copy
 //  of this software and associated documentation files (the "Software"), to deal
@@ -38,6 +38,8 @@
 
 void CommandListen( const std::vector< std::string >& args );
 
+void CommandPixy( const std::vector< std::string >& args );
+
 void CommandSpeed( const std::vector< std::string >& args );
 void CommandSteer( const std::vector< std::string >& args );
 
--- a/main/robots/cantool/jamfile	Mon May 02 19:43:34 2016 -0700
+++ b/main/robots/cantool/jamfile	Mon May 30 19:04:39 2016 -0700
@@ -5,7 +5,7 @@
 #   Bob Cook Development, Robotics Library
 #   http://www.bobcookdev.com/rl/
 #    
-#   Copyright (c) 2011-2013 Bob Cook
+#   Copyright (c) 2011-2016 Bob Cook
 #
 #   Permission is hereby granted, free of charge, to any person obtaining a copy
 #   of this software and associated documentation files (the "Software"), to deal
@@ -37,8 +37,8 @@
 COMMON_SOURCES = 
     main.cpp
     CanToolApp.cpp
-    CmdEStop.cpp CmdGps.cpp CmdListen.cpp CmdSpeed.cpp CmdSonarFront.cpp CmdSteer.cpp
-    CmdStartPgm.cpp
+    CmdEStop.cpp CmdGps.cpp CmdListen.cpp CmdPixy.cpp CmdSpeed.cpp CmdSonarFront.cpp
+    CmdSteer.cpp CmdStartPgm.cpp
     packages.common.can.pkg
     packages.linux.can.pkg
     ;
--- a/main/robots/odr-sim/odrsim.log	Mon May 02 19:43:34 2016 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,341 +0,0 @@
-I 12/30/11-15:41:54.638594 ------------------------------------------------------
-I 12/30/11-15:41:54.638893 ODR H/W Simulator startup
-I 12/30/11-15:41:54.638909 ODRSimApp::main() started
-I 12/30/11-15:41:54.639032 using CANbus interface name "can0"
-I 12/30/11-15:41:54.740234 CAN frame send: [02:00:0012] 09                   .
-I 12/30/11-15:42:11.398476 CAN frame send: [02:00:0012] 09                   .
-I 12/30/11-15:42:13.911409 CAN frame send: [02:00:0012] 09                   .
-I 12/30/11-15:42:16.431669 CAN frame send: [02:00:0012] 09                   .
-I 12/30/11-15:42:18.947417 CAN frame send: [02:00:0012] 09                   .
-I 12/30/11-15:42:21.466028 CAN frame send: [02:00:0012] 08                   .
-I 12/30/11-15:42:23.983330 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:25.720028 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:26.426648 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:28.223911 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:28.930324 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:30.727640 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:31.432743 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:33.233196 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:33.938857 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:35.737285 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:36.443286 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:38.240750 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:38.944917 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:40.743815 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:41.448870 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:43.248206 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:43.954355 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:45.752622 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:46.458559 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:48.258283 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:48.965882 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:50.762645 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:51.468553 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:53.266126 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:53.973406 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:55.770770 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:56.476359 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:42:58.274529 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:42:58.978542 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:43:00.776061 CAN frame send: [03:00:0131]                      
-I 12/30/11-15:43:01.479613 CAN frame send: [02:00:0012] 0A                   .
-I 12/30/11-15:43:02.485439 ODR H/W Simulator shutdown
-I 12/30/11-15:44:09.586276 ------------------------------------------------------
-I 12/30/11-15:44:09.586532 ODR H/W Simulator startup
-I 12/30/11-15:44:09.586548 ODRSimApp::main() started
-I 12/30/11-15:44:09.586655 using CANbus interface name "can0"
-I 12/30/11-15:46:06.045971 ODR H/W Simulator shutdown
-I 12/30/11-15:50:52.906067 ------------------------------------------------------
-I 12/30/11-15:50:52.906316 ODR H/W Simulator startup
-I 12/30/11-15:50:52.906331 ODRSimApp::main() started
-I 12/30/11-15:50:52.906434 using CANbus interface name "can0"
-I 12/30/11-15:53:14.681129 ODR H/W Simulator shutdown
-I 01/13/12-05:29:48.828683 ------------------------------------------------------
-I 01/13/12-05:29:48.838202 ODR H/W Simulator startup
-I 01/13/12-05:29:48.838220 ODRSimApp::main() started
-I 01/13/12-05:29:48.838326 using CANbus interface name "can0"
-I 01/13/12-05:30:27.861651 ODR H/W Simulator shutdown
-I 02/11/12-20:00:09.841334 ------------------------------------------------------
-I 02/11/12-20:00:10.044188 ODR H/W Simulator startup
-I 02/11/12-20:00:10.044232 ODRSimApp::main() started
-I 02/11/12-20:00:10.044382 using CANbus interface name "can0"
-I 02/11/12-20:01:44.293176 ODR H/W Simulator shutdown
-I 02/11/12-22:09:02.353065 ------------------------------------------------------
-I 02/11/12-22:09:02.353311 ODR H/W Simulator startup
-I 02/11/12-22:09:02.353327 ODRSimApp::main() started
-I 02/11/12-22:09:02.353429 using CANbus interface name "can0"
-I 02/11/12-22:11:38.319707 ODR H/W Simulator shutdown
-I 02/12/12-18:43:38.707217 ------------------------------------------------------
-I 02/12/12-18:43:38.707452 ODR H/W Simulator startup
-I 02/12/12-18:43:38.707467 ODRSimApp::main() started
-I 02/12/12-18:43:38.707568 using CANbus interface name "can0"
-I 02/12/12-18:46:10.109877 ODR H/W Simulator shutdown
-I 06/09/12-19:53:40.084032 ------------------------------------------------------
-I 06/09/12-19:53:40.118266 ODR H/W Simulator startup
-I 06/09/12-19:53:40.118307 ODRSimApp::main() started
-I 06/09/12-19:53:40.118446 using CANbus interface name "can0"
-I 06/09/12-20:01:09.281913 ODR H/W Simulator shutdown
-I 06/09/12-20:16:00.804035 ------------------------------------------------------
-I 06/09/12-20:16:00.804261 ODR H/W Simulator startup
-I 06/09/12-20:16:00.804277 ODRSimApp::main() started
-I 06/09/12-20:16:00.804378 using CANbus interface name "can0"
-I 07/08/12-00:04:43.311729 ------------------------------------------------------
-I 07/08/12-00:04:43.333980 ODR H/W Simulator startup
-I 07/08/12-00:04:43.334026 ODRSimApp::main() started
-I 07/08/12-00:04:43.334173 using CANbus interface name "can0"
-I 07/08/12-00:05:00.460464 ODR H/W Simulator shutdown
-I 07/08/12-00:09:37.061681 ------------------------------------------------------
-I 07/08/12-00:09:37.061906 ODR H/W Simulator startup
-I 07/08/12-00:09:37.061922 ODRSimApp::main() started
-I 07/08/12-00:09:37.062025 using CANbus interface name "can0"
-I 07/08/12-00:09:50.248281 ODR H/W Simulator shutdown
-I 07/08/12-00:10:51.106037 ------------------------------------------------------
-I 07/08/12-00:10:51.106729 ODR H/W Simulator startup
-I 07/08/12-00:10:51.106745 ODRSimApp::main() started
-I 07/08/12-00:10:51.106849 using CANbus interface name "can0"
-I 07/08/12-00:11:03.599376 ODR H/W Simulator shutdown
-I 02/09/13-20:54:32.547108 ------------------------------------------------------
-I 02/09/13-20:54:32.552550 ODR H/W Simulator startup
-I 02/09/13-20:54:32.552582 ODRSimApp::main() started
-I 02/09/13-20:54:32.552698 using CANbus interface name "can0"
-I 02/09/13-20:54:56.482210 ODR H/W Simulator shutdown
-I 08/10/13-21:23:54.877694 ------------------------------------------------------
-I 08/10/13-21:23:54.877985 ODR H/W Simulator startup
-I 08/10/13-21:23:54.877999 ODRSimApp::main() started
-I 08/10/13-21:23:54.878076 using CANbus interface name "can0"
-I 08/10/13-21:25:15.574660 ODR H/W Simulator shutdown
-I 08/10/13-21:32:15.271464 ------------------------------------------------------
-I 08/10/13-21:32:15.271537 ODR H/W Simulator startup
-I 08/10/13-21:32:15.271546 ODRSimApp::main() started
-I 08/10/13-21:32:15.271615 using CANbus interface name "can0"
-I 08/10/13-21:32:22.317674 ODR H/W Simulator shutdown
-I 08/10/13-21:33:55.119721 ------------------------------------------------------
-I 08/10/13-21:33:55.119801 ODR H/W Simulator startup
-I 08/10/13-21:33:55.119810 ODRSimApp::main() started
-I 08/10/13-21:33:55.119876 using CANbus interface name "can0"
-I 08/10/13-21:34:07.921040 ODR H/W Simulator shutdown
-I 08/10/13-21:35:12.551851 ------------------------------------------------------
-I 08/10/13-21:35:12.551922 ODR H/W Simulator startup
-I 08/10/13-21:35:12.551931 ODRSimApp::main() started
-I 08/10/13-21:35:12.551994 using CANbus interface name "can0"
-I 08/10/13-21:35:29.196782 ODR H/W Simulator shutdown
-I 08/10/13-21:36:14.001590 ------------------------------------------------------
-I 08/10/13-21:36:14.001661 ODR H/W Simulator startup
-I 08/10/13-21:36:14.001671 ODRSimApp::main() started
-I 08/10/13-21:36:14.001747 using CANbus interface name "can0"
-I 08/10/13-21:36:38.997458 ODR H/W Simulator shutdown
-I 08/10/13-21:38:56.914045 ------------------------------------------------------
-I 08/10/13-21:38:56.914115 ODR H/W Simulator startup
-I 08/10/13-21:38:56.914124 ODRSimApp::main() started
-I 08/10/13-21:38:56.914190 using CANbus interface name "can0"
-I 08/10/13-21:39:00.031050 ODR H/W Simulator shutdown
-I 08/10/13-21:39:32.102198 ------------------------------------------------------
-I 08/10/13-21:39:32.102277 ODR H/W Simulator startup
-I 08/10/13-21:39:32.102285 ODRSimApp::main() started
-I 08/10/13-21:39:32.102352 using CANbus interface name "can0"
-I 08/10/13-21:39:36.025963 ODR H/W Simulator shutdown
-I 08/10/13-21:40:52.166575 ------------------------------------------------------
-I 08/10/13-21:40:52.166650 ODR H/W Simulator startup
-I 08/10/13-21:40:52.166659 ODRSimApp::main() started
-I 08/10/13-21:40:52.166727 using CANbus interface name "can0"
-I 08/10/13-21:41:06.948733 ODR H/W Simulator shutdown
-I 08/10/13-21:43:05.306256 ------------------------------------------------------
-I 08/10/13-21:43:05.306336 ODR H/W Simulator startup
-I 08/10/13-21:43:05.306346 ODRSimApp::main() started
-I 08/10/13-21:43:05.306446 using CANbus interface name "can0"
-I 08/10/13-21:43:49.243835 ODR H/W Simulator shutdown
-I 08/10/13-21:44:03.223969 ------------------------------------------------------
-I 08/10/13-21:44:03.224050 ODR H/W Simulator startup
-I 08/10/13-21:44:03.224060 ODRSimApp::main() started
-I 08/10/13-21:44:03.224131 using CANbus interface name "can0"
-I 08/10/13-21:44:17.020165 ODR H/W Simulator shutdown
-I 08/10/13-22:05:58.303742 ------------------------------------------------------
-I 08/10/13-22:05:58.303834 ODR H/W Simulator startup
-I 08/10/13-22:05:58.303876 ODRSimApp::main() started
-I 08/10/13-22:05:58.303973 using CANbus interface name "can0"
-I 08/10/13-22:06:29.378061 ODR H/W Simulator shutdown
-I 08/10/13-22:08:04.788293 ------------------------------------------------------
-I 08/10/13-22:08:04.788383 ODR H/W Simulator startup
-I 08/10/13-22:08:04.788395 ODRSimApp::main() started
-I 08/10/13-22:08:04.788483 using CANbus interface name "can0"
-I 08/10/13-22:08:17.998494 ODR H/W Simulator shutdown
-I 08/10/13-22:09:40.075972 ------------------------------------------------------
-I 08/10/13-22:09:40.076065 ODR H/W Simulator startup
-I 08/10/13-22:09:40.076078 ODRSimApp::main() started
-I 08/10/13-22:09:40.076165 using CANbus interface name "can0"
-I 08/10/13-22:09:44.196287 ODR H/W Simulator shutdown
-I 08/10/13-22:11:30.568274 ------------------------------------------------------
-I 08/10/13-22:11:30.568382 ODR H/W Simulator startup
-I 08/10/13-22:11:30.568392 ODRSimApp::main() started
-I 08/10/13-22:11:30.568462 using CANbus interface name "can0"
-I 08/10/13-22:11:36.005252 ODR H/W Simulator shutdown
-I 08/10/13-22:12:49.786019 ------------------------------------------------------
-I 08/10/13-22:12:49.786092 ODR H/W Simulator startup
-I 08/10/13-22:12:49.786102 ODRSimApp::main() started
-I 08/10/13-22:12:49.786169 using CANbus interface name "can0"
-I 08/10/13-22:13:15.207680 ODR H/W Simulator shutdown
-I 08/10/13-22:17:31.113035 ------------------------------------------------------
-I 08/10/13-22:17:31.113115 ODR H/W Simulator startup
-I 08/10/13-22:17:31.113126 ODRSimApp::main() started
-I 08/10/13-22:17:31.113200 using CANbus interface name "can0"
-I 08/10/13-22:17:44.318427 ODR H/W Simulator shutdown
-I 08/10/13-22:21:52.798099 ------------------------------------------------------
-I 08/10/13-22:21:52.798198 ODR H/W Simulator startup
-I 08/10/13-22:21:52.798211 ODRSimApp::main() started
-I 08/10/13-22:21:52.798303 using CANbus interface name "can0"
-I 08/10/13-22:22:03.473455 ODR H/W Simulator shutdown
-I 08/10/13-22:22:48.510786 ------------------------------------------------------
-I 08/10/13-22:22:48.510859 ODR H/W Simulator startup
-I 08/10/13-22:22:48.510868 ODRSimApp::main() started
-I 08/10/13-22:22:48.510935 using CANbus interface name "can0"
-I 08/10/13-22:22:59.191150 ODR H/W Simulator shutdown
-I 08/10/13-22:27:23.774583 ------------------------------------------------------
-I 08/10/13-22:27:23.774666 ODR H/W Simulator startup
-I 08/10/13-22:27:23.774675 ODRSimApp::main() started
-I 08/10/13-22:27:23.774743 using CANbus interface name "can0"
-I 08/10/13-22:27:34.057964 ODR H/W Simulator shutdown
-I 08/10/13-22:30:07.736631 ------------------------------------------------------
-I 08/10/13-22:30:07.736721 ODR H/W Simulator startup
-I 08/10/13-22:30:07.736733 ODRSimApp::main() started
-I 08/10/13-22:30:07.736821 using CANbus interface name "can0"
-I 08/10/13-22:30:19.627229 ODR H/W Simulator shutdown
-I 08/10/13-22:32:00.890957 ------------------------------------------------------
-I 08/10/13-22:32:00.891272 ODR H/W Simulator startup
-I 08/10/13-22:32:00.891283 ODRSimApp::main() started
-I 08/10/13-22:32:00.891351 using CANbus interface name "can0"
-I 08/10/13-22:32:21.353636 ODR H/W Simulator shutdown
-I 08/10/13-22:35:23.221157 ------------------------------------------------------
-I 08/10/13-22:35:23.221248 ODR H/W Simulator startup
-I 08/10/13-22:35:23.221260 ODRSimApp::main() started
-I 08/10/13-22:35:23.221348 using CANbus interface name "can0"
-I 08/10/13-22:35:42.975009 ODR H/W Simulator shutdown
-I 08/10/13-22:37:16.698070 ------------------------------------------------------
-I 08/10/13-22:37:16.698161 ODR H/W Simulator startup
-I 08/10/13-22:37:16.698173 ODRSimApp::main() started
-I 08/10/13-22:37:16.698260 using CANbus interface name "can0"
-I 08/10/13-22:37:31.712473 ODR H/W Simulator shutdown
-I 08/10/13-22:38:20.493683 ------------------------------------------------------
-I 08/10/13-22:38:20.493757 ODR H/W Simulator startup
-I 08/10/13-22:38:20.493767 ODRSimApp::main() started
-I 08/10/13-22:38:20.493834 using CANbus interface name "can0"
-I 08/10/13-22:38:26.931993 ODR H/W Simulator shutdown
-I 08/10/13-22:38:49.599385 ------------------------------------------------------
-I 08/10/13-22:38:49.599457 ODR H/W Simulator startup
-I 08/10/13-22:38:49.599466 ODRSimApp::main() started
-I 08/10/13-22:38:49.599532 using CANbus interface name "can0"
-I 08/10/13-22:39:14.905809 ODR H/W Simulator shutdown
-I 08/10/13-22:40:30.139337 ------------------------------------------------------
-I 08/10/13-22:40:30.139408 ODR H/W Simulator startup
-I 08/10/13-22:40:30.139418 ODRSimApp::main() started
-I 08/10/13-22:40:30.139504 using CANbus interface name "can0"
-I 08/10/13-22:40:45.960987 ODR H/W Simulator shutdown
-I 08/10/13-22:41:21.006798 ------------------------------------------------------
-I 08/10/13-22:41:21.006887 ODR H/W Simulator startup
-I 08/10/13-22:41:21.006899 ODRSimApp::main() started
-I 08/10/13-22:41:21.007353 using CANbus interface name "can0"
-I 08/10/13-22:41:30.382858 ODR H/W Simulator shutdown
-I 08/10/13-22:42:09.184492 ------------------------------------------------------
-I 08/10/13-22:42:09.184581 ODR H/W Simulator startup
-I 08/10/13-22:42:09.184593 ODRSimApp::main() started
-I 08/10/13-22:42:09.184680 using CANbus interface name "can0"
-I 08/10/13-22:45:23.453537 ODR H/W Simulator shutdown
-I 08/10/13-22:45:44.661356 ------------------------------------------------------
-I 08/10/13-22:45:44.661428 ODR H/W Simulator startup
-I 08/10/13-22:45:44.661437 ODRSimApp::main() started
-I 08/10/13-22:45:44.661504 using CANbus interface name "can0"
-I 08/10/13-22:46:14.046225 ODR H/W Simulator shutdown
-I 08/10/13-23:06:03.703308 ------------------------------------------------------
-I 08/10/13-23:06:03.703389 ODR H/W Simulator startup
-I 08/10/13-23:06:03.703399 ODRSimApp::main() started
-I 08/10/13-23:06:03.703468 using CANbus interface name "can0"
-I 08/10/13-23:06:58.048740 ODR H/W Simulator shutdown
-I 08/10/13-23:10:50.459136 ------------------------------------------------------
-I 08/10/13-23:10:50.459213 ODR H/W Simulator startup
-I 08/10/13-23:10:50.459222 ODRSimApp::main() started
-I 08/10/13-23:10:50.459292 using CANbus interface name "can0"
-I 08/10/13-23:11:37.678220 ODR H/W Simulator shutdown
-I 08/11/13-18:21:33.889143 ------------------------------------------------------
-I 08/11/13-18:21:33.889227 ODR H/W Simulator startup
-I 08/11/13-18:21:33.889236 ODRSimApp::main() started
-I 08/11/13-18:21:33.889318 using CANbus interface name "can0"
-I 08/16/13-02:00:50.781111 ODR H/W Simulator shutdown
-I 08/17/13-18:07:44.662561 ------------------------------------------------------
-I 08/17/13-18:07:44.663440 ODR H/W Simulator startup
-I 08/17/13-18:07:44.663471 ODRSimApp::main() started
-I 08/17/13-18:07:44.663612 using CANbus interface name "can0"
-I 08/17/13-18:09:40.583010 ODR H/W Simulator shutdown
-I 07/12/14-18:25:54.972583 ------------------------------------------------------
-I 07/12/14-18:25:54.973245 ODR H/W Simulator startup
-I 07/12/14-18:25:54.973267 ODRSimApp::main() started
-I 07/12/14-18:25:54.973372 using CANbus interface name "can0"
-I 07/12/14-18:27:11.818084 ODR H/W Simulator shutdown
-I 07/12/14-19:00:23.939175 ------------------------------------------------------
-I 07/12/14-19:00:23.939292 ODR H/W Simulator startup
-I 07/12/14-19:00:23.939306 ODRSimApp::main() started
-I 07/12/14-19:00:23.939399 using CANbus interface name "can0"
-I 07/12/14-19:02:08.176230 ODR H/W Simulator shutdown
-I 07/12/14-19:21:40.436115 ------------------------------------------------------
-I 07/12/14-19:21:40.436234 ODR H/W Simulator startup
-I 07/12/14-19:21:40.436248 ODRSimApp::main() started
-I 07/12/14-19:21:40.436342 using CANbus interface name "can0"
-I 07/12/14-19:22:05.701147 ODR H/W Simulator shutdown
-I 07/12/14-19:40:23.244222 ------------------------------------------------------
-I 07/12/14-19:40:23.244334 ODR H/W Simulator startup
-I 07/12/14-19:40:23.244347 ODRSimApp::main() started
-I 07/12/14-19:40:23.244438 using CANbus interface name "can0"
-I 07/12/14-19:44:43.266963 ODR H/W Simulator shutdown
-I 07/12/14-19:47:51.473531 ------------------------------------------------------
-I 07/12/14-19:47:51.473649 ODR H/W Simulator startup
-I 07/12/14-19:47:51.473663 ODRSimApp::main() started
-I 07/12/14-19:47:51.473753 using CANbus interface name "can0"
-I 07/12/14-19:48:00.352214 ODR H/W Simulator shutdown
-I 07/12/14-20:17:52.302488 ------------------------------------------------------
-I 07/12/14-20:17:52.302848 ODR H/W Simulator startup
-I 07/12/14-20:17:52.302866 ODRSimApp::main() started
-I 07/12/14-20:17:52.302964 using CANbus interface name "can0"
-I 07/12/14-20:18:54.617871 ODR H/W Simulator shutdown
-I 07/12/14-20:24:05.654917 ------------------------------------------------------
-I 07/12/14-20:24:05.655027 ODR H/W Simulator startup
-I 07/12/14-20:24:05.655041 ODRSimApp::main() started
-I 07/12/14-20:24:05.655136 using CANbus interface name "can0"
-I 07/12/14-20:24:52.235568 ODR H/W Simulator shutdown
-I 07/12/14-22:04:28.953071 ------------------------------------------------------
-I 07/12/14-22:04:28.953192 ODR H/W Simulator startup
-I 07/12/14-22:04:28.953206 ODRSimApp::main() started
-I 07/12/14-22:04:28.953298 using CANbus interface name "can0"
-I 07/12/14-22:08:10.500004 ODR H/W Simulator shutdown
-I 07/12/14-22:18:54.694580 ------------------------------------------------------
-I 07/12/14-22:18:54.694698 ODR H/W Simulator startup
-I 07/12/14-22:18:54.694712 ODRSimApp::main() started
-I 07/12/14-22:18:54.694803 using CANbus interface name "can0"
-I 07/12/14-22:25:29.472422 ODR H/W Simulator shutdown
-I 07/12/14-22:25:54.573827 ------------------------------------------------------
-I 07/12/14-22:25:54.573932 ODR H/W Simulator startup
-I 07/12/14-22:25:54.573945 ODRSimApp::main() started
-I 07/12/14-22:25:54.574036 using CANbus interface name "can0"
-I 07/12/14-22:29:47.876123 ODR H/W Simulator shutdown
-I 07/13/14-01:04:28.359774 ------------------------------------------------------
-I 07/13/14-01:04:28.359885 ODR H/W Simulator startup
-I 07/13/14-01:04:28.359899 ODRSimApp::main() started
-I 07/13/14-01:04:28.359991 using CANbus interface name "can0"
-I 07/13/14-01:05:03.108401 ODR H/W Simulator shutdown
-I 07/13/14-01:08:11.853011 ------------------------------------------------------
-I 07/13/14-01:08:11.853286 ODR H/W Simulator startup
-I 07/13/14-01:08:11.853303 ODRSimApp::main() started
-I 07/13/14-01:08:11.853549 using CANbus interface name "can0"
-I 07/13/14-01:20:18.090331 ODR H/W Simulator shutdown
-I 07/13/14-01:25:10.431615 ------------------------------------------------------
-I 07/13/14-01:25:10.431829 ODR H/W Simulator startup
-I 07/13/14-01:25:10.431857 ODRSimApp::main() started
-I 07/13/14-01:25:10.432053 using CANbus interface name "can0"
-I 07/13/14-01:26:01.485262 ODR H/W Simulator shutdown
-I 07/13/14-01:26:24.930296 ------------------------------------------------------
-I 07/13/14-01:26:24.930404 ODR H/W Simulator startup
-I 07/13/14-01:26:24.930418 ODRSimApp::main() started
-I 07/13/14-01:26:24.930510 using CANbus interface name "can0"
-I 07/13/14-01:27:00.229683 ODR H/W Simulator shutdown
-I 07/13/14-01:31:20.908956 ------------------------------------------------------
-I 07/13/14-01:31:20.909050 ODR H/W Simulator startup
-I 07/13/14-01:31:20.909060 ODRSimApp::main() started
-I 07/13/14-01:31:20.909127 using CANbus interface name "can0"
-I 07/13/14-01:36:17.269122 ODR H/W Simulator shutdown
--- a/main/robots/odr/PixyApp.cpp	Mon May 02 19:43:34 2016 -0700
+++ b/main/robots/odr/PixyApp.cpp	Mon May 30 19:04:39 2016 -0700
@@ -119,6 +119,15 @@
 
 // ----------------------------------------------------------------------------------------
 
+void PixyApp::recvPixyGrabFrame()
+{
+    if ( PixyReader::grabFrame( /* std::vector< uint8_t >* data = NULL */ ) )
+    {
+    }
+}
+
+// ----------------------------------------------------------------------------------------
+
 void PixyApp::recvEmergency( uint8_t srcNode )
 {
 #if 0
@@ -251,12 +260,19 @@
                         break;
 
                     case can_dataid_pixy_start_tracking:
+                        log.information( std::string( "pixy_start_tracking" ) );
                         recvSetPixyTracking( true );
                         break;
 
                     case can_dataid_pixy_stop_tracking:
+                        log.information( std::string( "pixy_stop_tracking" ) );
                         recvSetPixyTracking( false );
                         break;
+
+                    case can_dataid_pixy_grabframe:
+                        log.information( std::string( "pixy_grabframe" ) );
+                        recvPixyGrabFrame();
+                        break;
                 }
             }
         }
--- a/main/robots/odr/PixyApp.h	Mon May 02 19:43:34 2016 -0700
+++ b/main/robots/odr/PixyApp.h	Mon May 30 19:04:39 2016 -0700
@@ -70,6 +70,7 @@
         void recvAllClear( uint8_t srcNode );
         void recvHeartbeat( uint8_t srcNode );
         void recvSetPixyTracking( bool enabled );
+        void recvPixyGrabFrame();
         void runLoop( const std::string& loggerName );
 
     private:
--- a/main/robots/odr/PixyReader.cpp	Mon May 02 19:43:34 2016 -0700
+++ b/main/robots/odr/PixyReader.cpp	Mon May 30 19:04:39 2016 -0700
@@ -38,7 +38,9 @@
 //#include <cmath>
 //#include <stdexcept>
 //#include <utility>
-//#include <vector>
+#include <vector>
+
+#include <stdio.h>
 
 #include <Poco/Exception.h>
 #include <Poco/Logger.h>
@@ -170,15 +172,6 @@
         return false;
     }
 
-    // check if the IMU is actually offline; more than 2 seconds silence means yes
-
-    static const Poco::Timestamp::TimeDiff TwoSeconds = Poco::Timestamp::resolution() * 2;
-
-    if ( sm_pixyLastUpdate.elapsed() > TwoSeconds )
-    {
-        sm_isPixyAlive = false;
-    }
-
     return sm_isPixyAlive;
 }
 
@@ -198,6 +191,73 @@
 
 // ----------------------------------------------------------------------------------------
 
+bool PixyReader::grabFrame( std::vector< uint8_t >* data )
+{
+    Poco::RWLock::ScopedReadLock lock( sm_rwLock );
+
+    if ( ! sm_isPixyAlive )
+    {
+        return false;
+    }
+
+    int32_t  response = 0;
+    uint32_t fourcc = 0;
+    int8_t   renderflags;
+    uint16_t width = 0, height = 0;
+    uint32_t numPixels = 0;
+    uint8_t* frame;
+
+    int result = pixy_command( "cam_getFrame",  // String id for remote procedure
+                               0x01, 0x21,      // mode
+                               0x02, 0,         // xoffset
+                               0x02, 0,         // yoffset
+                               0x02, 320,       // width
+                               0x02, 200,       // height
+                               0,               // separator
+                               &response,
+                               &fourcc,
+                               &renderflags,
+                               &width,
+                               &height,
+                               &numPixels,
+                               &frame,     // pointer to mem address for returned frame
+                               0 );
+
+    printf( "grabFrame() result: %d response %d height %d width %d numPixels %d fourcc = %c%c%c%c\n",
+            result, response, height, width, numPixels, 
+            static_cast< char >( fourcc >> 24 ),
+            static_cast< char >( fourcc >> 16 ),
+            static_cast< char >( fourcc >>  8 ),
+            static_cast< char >( fourcc ) );
+
+    if ( result != 0 )
+    {
+        return false;
+    }
+
+    FILE* fd = fopen( "image.raw", "w" );
+    fwrite( frame, 1, numPixels, fd );
+    fclose( fd );
+
+    if ( data == NULL )
+    {
+        return true;
+    }
+
+    std::vector< uint8_t > theImage( numPixels );
+
+    for ( size_t i = 0; i < data->size(); ++i )
+    {
+        theImage[ i ] = *frame++;
+    }
+
+    data->swap( theImage );
+
+    return true;
+}
+
+// ----------------------------------------------------------------------------------------
+
 PixyReader::PixyReader( const std::string& loggerName )
     : Poco::Runnable(),
       m_loggerName( loggerName ),
--- a/main/robots/odr/PixyReader.h	Mon May 02 19:43:34 2016 -0700
+++ b/main/robots/odr/PixyReader.h	Mon May 30 19:04:39 2016 -0700
@@ -47,6 +47,7 @@
     public:
         static bool isPixyAlive();
         static bool hasTarget( int8_t* position = NULL );
+        static bool grabFrame( std::vector< uint8_t >* data = NULL );
 
     public:
         PixyReader( const std::string& loggerName );