changeset 233:b9288cad0bfb main

Receive the "start program" message and post to the scoreboard. Tasks can use that information to know what to do.
author Bob Cook <bob@bobcookdev.com>
date Sun, 13 Jul 2014 09:12:48 -0700
parents 417b3f3501ca
children 5657cf2325c9
files main/robots/odr/ODRApp.cpp main/robots/odr/Scoreboard.cpp main/robots/odr/Scoreboard.h
diffstat 3 files changed, 26 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/main/robots/odr/ODRApp.cpp	Sat Jul 12 17:23:23 2014 -0700
+++ b/main/robots/odr/ODRApp.cpp	Sun Jul 13 09:12:48 2014 -0700
@@ -7,7 +7,7 @@
 //
 //  Application object implementation for the outdoor robot project.
 //
-//  Copyright (c) 2011-2013 Bob Cook
+//  Copyright (c) 2011-2014 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
@@ -146,6 +146,8 @@
     Scoreboard   scoreboard( logger().name() );
     scoreboardThread.start( scoreboard );
 
+    Scoreboard::navSetMaximumSpeed( 15 );
+
     m_tasks.clear();
 
     m_tasks.push_back(
@@ -163,8 +165,8 @@
 //    m_tasks.push_back(
 //            Poco::SharedPtr< TaskObject >( new SquareCourseTask( logger().name() ) ) );
 
-    m_tasks.push_back(
-            Poco::SharedPtr< TaskObject >( new NavigateTask( logger().name() ) ) );
+//    m_tasks.push_back(
+//            Poco::SharedPtr< TaskObject >( new NavigateTask( logger().name() ) ) );
 
     m_tasks.push_back(
             Poco::SharedPtr< TaskObject >( new CruisingTask( logger().name() ) ) );
--- a/main/robots/odr/Scoreboard.cpp	Sat Jul 12 17:23:23 2014 -0700
+++ b/main/robots/odr/Scoreboard.cpp	Sun Jul 13 09:12:48 2014 -0700
@@ -311,6 +311,7 @@
 {
     Poco::RWLock::ScopedWriteLock lock( sm_rwLock );
     sm_hasActiveProgram = false;
+    sm_activeProgram    = 0;
 }
 
 // ----------------------------------------------------------------------------------------
@@ -410,6 +411,7 @@
 
 void Scoreboard::logSystemStatus( Poco::Timer& timer )
 {
+#if 0
     Poco::Logger& log = Poco::Logger::get( m_loggerName );
 
     Poco::RWLock::ScopedReadLock lock( sm_rwLock );
@@ -433,6 +435,7 @@
     {
         log.information( "Scoreboard: GPS is not alive" );
     }
+#endif
 }
 
 // ----------------------------------------------------------------------------------------
@@ -762,6 +765,19 @@
 
 // ----------------------------------------------------------------------------------------
 
+void Scoreboard::recvStartProgram( CANMessage* msg )
+{
+    can_data_pgm_selection info;
+    msg->msgData( reinterpret_cast< uint8_t* >( &info ), sizeof( info ) );
+
+    Poco::RWLock::ScopedWriteLock lock( sm_rwLock );
+
+    sm_hasActiveProgram = true;
+    sm_activeProgram = info.pgm_id;
+}
+
+// ----------------------------------------------------------------------------------------
+
 void Scoreboard::run()
 {
     Poco::Logger& log = Poco::Logger::get( m_loggerName );
@@ -844,6 +860,10 @@
                     case can_dataid_imu_yaw:
                         recvImuYaw( msg );
                         break;
+
+                    case can_dataid_odr_start_pgm:
+                        recvStartProgram( msg );
+                        break;
                 }
             }
         }
--- a/main/robots/odr/Scoreboard.h	Sat Jul 12 17:23:23 2014 -0700
+++ b/main/robots/odr/Scoreboard.h	Sun Jul 13 09:12:48 2014 -0700
@@ -179,6 +179,7 @@
         void recvImuRoll( CANMessage* msg );
         void recvImuPitch( CANMessage* msg );
         void recvImuYaw( CANMessage* msg );
+        void recvStartProgram( CANMessage* msg );
 };
 
 // ----------------------------------------------------------------------------------------