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 (current diff) acdf982637fc (diff)
children
files main/packages/avr/lcd/.DS_Store main/packages/common/.DS_Store
diffstat 6 files changed, 32 insertions(+), 84 deletions(-) [+]
line wrap: on
line diff
Binary file main/packages/avr/lcd/.DS_Store has changed
Binary file main/packages/common/.DS_Store has changed
--- a/main/robots/odr-display/canmsgs.cpp	Mon May 30 19:04:27 2016 -0700
+++ b/main/robots/odr-display/canmsgs.cpp	Mon May 30 19:04:39 2016 -0700
@@ -194,20 +194,6 @@
 
 // ----------------------------------------------------------------------------------------
 
-static void update_origin_lat( const can_data_gps_data* data )
-{
-    display_update_origin_lat( data->degrees, data->min_thousandths );
-}
-
-// ----------------------------------------------------------------------------------------
-
-static void update_origin_lon( const can_data_gps_data* data )
-{
-    display_update_origin_lon( data->degrees, data->min_thousandths );
-}
-
-// ----------------------------------------------------------------------------------------
-
 static void update_target_lat( const can_data_gps_data* data )
 {
     display_update_target_lat( data->degrees, data->min_thousandths );
@@ -313,14 +299,6 @@
                 update_gps_fix( reinterpret_cast< can_data_gps_fix* >( &recvdata ) );
                 break;
 
-            case can_dataid_origin_lat:
-                update_origin_lat( reinterpret_cast< can_data_gps_data* >( &recvdata ) );
-                break;
-
-            case can_dataid_origin_long:
-                update_origin_lon( reinterpret_cast< can_data_gps_data* >( &recvdata ) );
-                break;
-
             case can_dataid_target_lat:
                 update_target_lat( reinterpret_cast< can_data_gps_data* >( &recvdata ) );
                 break;
--- a/main/robots/odr-display/display.cpp	Mon May 30 19:04:27 2016 -0700
+++ b/main/robots/odr-display/display.cpp	Mon May 30 19:04:39 2016 -0700
@@ -1,6 +1,6 @@
 // ----------------------------------------------------------------------------------------
 //
-//  Copyright (C) 2012-2014 Bob Cook
+//  Copyright (C) 2012-2015 Bob Cook
 //    
 //  Bob Cook Development, Robotics Library
 //  http://www.bobcookdev.com/rl/
@@ -62,9 +62,9 @@
 //     10-|        location (00)         |-
 //      1-|  N 123 45.678  W 123 45.678  |-
 //      2-|                              |-
-//      3-|     origin (123.4) target    |-
-//      4-| N 123 45.678    N 123 45.678 |-
-//      5-| W 123 45.678    W 123 45.678 |-
+//      3-|            target            |-
+//      4-|  N 123 45.678  W 123 45.678  |-
+//      5-|                              |-
 //      6-|                              |-
 //      7-|  inertial measurement unit   |-
 //      8-|   Y +000  P +00.0  R +00.0   |-
@@ -200,7 +200,7 @@
     str_write_pgm( PSTR("f:     /      r:     /"), 2, 5 );
     str_write_pgm( PSTR("front obstacles"), 7, 7 );
     str_write_pgm( PSTR("location (--)"), 8, 10 );
-    str_write_pgm( PSTR("origin         target"), 5, 13 );
+    str_write_pgm( PSTR("target"), 12, 13 );
     str_write_pgm( PSTR("inertial measurement unit"), 2, 17 );
 }
 
@@ -657,59 +657,21 @@
 
 // ----------------------------------------------------------------------------------------
 
-void display_update_origin_lat( int16_t degrees, int32_t min_thousandths )
+void display_update_target_lat( int16_t degrees, int32_t min_thousandths )
 {
     if ( degrees < 0 )
     {
-        str_write( 'S', 1, 14 );
+        str_write( 'S', 2, 14 );
         degrees *= -1;
     }
     else
     {
-        str_write( 'N', 1, 14 );
+        str_write( 'N', 2, 14 );
     }
 
     char buf[ 12 ];
     format_gps_value( degrees, min_thousandths, buf );
-    str_write( buf, 3, 14 );
-}
-
-// ----------------------------------------------------------------------------------------
-
-void display_update_origin_lon( int16_t degrees, int32_t min_thousandths )
-{
-    if ( degrees < 0 )
-    {
-        str_write( 'W', 1, 15 );
-        degrees *= -1;
-    }
-    else
-    {
-        str_write( 'E', 1, 15 );
-    }
-
-    char buf[ 12 ];
-    format_gps_value( degrees, min_thousandths, buf );
-    str_write( buf, 3, 15 );
-}
-
-// ----------------------------------------------------------------------------------------
-
-void display_update_target_lat( int16_t degrees, int32_t min_thousandths )
-{
-    if ( degrees < 0 )
-    {
-        str_write( 'S', 17, 14 );
-        degrees *= -1;
-    }
-    else
-    {
-        str_write( 'N', 17, 14 );
-    }
-
-    char buf[ 12 ];
-    format_gps_value( degrees, min_thousandths, buf );
-    str_write( buf, 19, 14 );
+    str_write( buf, 4, 14 );
 }
 
 // ----------------------------------------------------------------------------------------
@@ -718,17 +680,17 @@
 {
     if ( degrees < 0 )
     {
-        str_write( 'W', 17, 15 );
+        str_write( 'W', 16, 14 );
         degrees *= -1;
     }
     else
     {
-        str_write( 'E', 17, 15 );
+        str_write( 'E', 16, 14 );
     }
 
     char buf[ 12 ];
     format_gps_value( degrees, min_thousandths, buf );
-    str_write( buf, 19, 15 );
+    str_write( buf, 18, 14 );
 }
 
 // ----------------------------------------------------------------------------------------
--- a/main/robots/odr-display/func.h	Mon May 30 19:04:27 2016 -0700
+++ b/main/robots/odr-display/func.h	Mon May 30 19:04:39 2016 -0700
@@ -99,9 +99,6 @@
 void display_update_longitude( int16_t degrees, int32_t min_thousandths );
 void display_update_gps_fix( uint8_t satellites );
 
-void display_update_origin_lat( int16_t degrees, int32_t min_thousandths );
-void display_update_origin_lon( int16_t degrees, int32_t min_thousandths );
-
 void display_update_target_lat( int16_t degrees, int32_t min_thousandths );
 void display_update_target_lon( int16_t degrees, int32_t min_thousandths );
 
--- a/main/robots/orpheus/test-gripper.cpp	Mon May 30 19:04:27 2016 -0700
+++ b/main/robots/orpheus/test-gripper.cpp	Mon May 30 19:04:39 2016 -0700
@@ -238,6 +238,9 @@
 
 // ----------------------------------------------------------------------------------------
 
+static const uint16_t k_gripper_position_open   = 18656;
+static const uint16_t k_gripper_position_closed = 18050;
+
 int main()
 {
     //--    Initialize the hardware.
@@ -246,7 +249,7 @@
 
     //-- Put the servo into an "open" stage.
 
-    OCR1A = 18656;
+    OCR1A = k_gripper_position_open;
     spinwait_delay_ms( 1000 ); // let the servo move
     servo_suspend();
 
@@ -254,7 +257,7 @@
 
     for ( ;; )
     {
-        if ( PIND & ( ( 1 << PD6 ) | ( 1 << PD7 ) ) )
+        if ( ( PIND & ( ( 1 << PD6 ) | ( 1 << PD7 ) ) ) != 0 )
         {
             PORTD |= ( 1 << PD2 );
         }
@@ -267,12 +270,23 @@
         {
             PORTD &= ~( 1 << PD0 );
 
-            OCR1A = 18656;
+            OCR1A = k_gripper_position_open;
             servo_unsuspend();
             spinwait_delay_ms( 1000 ); // let the servo move
 
-            bool canDetection = false;
+            OCR1A = k_gripper_position_closed;
+            spinwait_delay_ms( 2500 ); // let the servo move
 
+            if ( ( PIND & ( ( 1 << PD6 ) | ( 1 << PD7 ) ) ) != 0 )
+            {
+                // can was not detected in the gripper
+                // move the gripper back to the open position
+                OCR1A = k_gripper_position_open;
+                spinwait_delay_ms( 1000 ); // let the servo move
+                servo_suspend();
+            }
+
+            /*
             for ( uint16_t value = 18600; value > 18100; value -= 10 )
             {
                 OCR1A = value;
@@ -287,16 +301,13 @@
 
             if ( ! canDetection )
             {
-                // move the gripper back to the open position
-                OCR1A = 18656;
-                spinwait_delay_ms( 1000 ); // let the servo move
-                servo_suspend();
             }
+            */
         }
         else if ( ( PIND & ( 1 << PD5 ) ) == 0 )
         {
             PORTD &= ~( 1 << PD1 );
-            OCR1A = 18656;
+            OCR1A = k_gripper_position_open;
             spinwait_delay_ms( 1000 ); // let the servo move
             servo_suspend();
         }