diff --git a/README.md b/README.md index 100bd14..e597ed4 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,10 @@ The Sonar Array will be composed of the following: - Software Driver running on a Board to use the Sonar Sensors, along with a ROS Node that can communicate with the Board that publishes this data over ROS. - Visualization tools used to see the Sonar Array in action +![](doc/Media/bench1_8April2025.jpg) +![](doc/Boards/ConnectBoard/elec/ConnectBoard/ConnectBoard.png) +![](doc/Media/rviz.png) + ## Project Plan | Status | Epic | | --- | --- | diff --git a/boards/SonarArrayBoard/SonarArrayBoard.spin2 b/boards/SonarArrayBoard/SonarArrayBoard.spin2 index 3690bd8..263c45c 100644 --- a/boards/SonarArrayBoard/SonarArrayBoard.spin2 +++ b/boards/SonarArrayBoard/SonarArrayBoard.spin2 @@ -10,7 +10,7 @@ CON { timing } _clkfreq = 160_000_000 'Standard clock frequency = 160 MHz m_clkfreq = _clkfreq/1000 FAST_LOOP_MSEC = 10 ' 100 Hz - MEDIUM_LOOP_MSEC = 20 ' 50 Hz + MEDIUM_LOOP_MSEC = 100 ' 50 Hz SLOW_LOOP_MSEC = 200 ' 5 Hz VERYSLOW_LOOP_MSEC = 1000 ' 1 Hz @@ -19,7 +19,7 @@ CON { IO-Comms } RX_DEBUG = 63 TX_DEBUG = 62 RX_COMM = 0 - TX_COMM = 1 + TX_COMM = 2 CON { Comms Constants } @@ -27,10 +27,40 @@ CON { Comms Constants } BAUDRATE_COMM = 115_200 CON { Sonar Constants } +'' Bank 1 + PIN_SONAR0 = 63 '' DOESNT WORK, SEE BUG #1558 + PIN_SONAR1 = 62 + PIN_SONAR2 = 61 + PIN_SONAR3 = 60 + PIN_SONAR4 = 59 + PIN_SONAR5 = 58 + PIN_SONAR6 = 57 + PIN_SONAR7 = 56 +'' Bank 2 +{ + PIN_SONAR0 = 55 + PIN_SONAR1 = 54 + PIN_SONAR2 = 53 + PIN_SONAR3 = 52 + PIN_SONAR4 = 51 + PIN_SONAR5 = 50 + PIN_SONAR6 = 49 + PIN_SONAR7 = 48 +} +'' Bank 3 +{ + PIN_SONAR0 = 47 PIN_SONAR1 = 46 + PIN_SONAR2 = 45 + PIN_SONAR3 = 44 + PIN_SONAR4 = 43 + PIN_SONAR5 = 42 + PIN_SONAR6 = 41 + PIN_SONAR7 = 40 +} CON { Other App Constants } - MAX_NUMBER_SONARS = 20 + MAX_NUMBER_SONARS = 1 VAR { timing } long fast_loop_counter @@ -44,7 +74,15 @@ VAR { Messaging } VAR { Sensor Variables } word fakedistance_cm + + word distance0_mm word distance1_mm + word distance2_mm + word distance3_mm + word distance4_mm + word distance5_mm + word distance6_mm + word distance7_mm @@ -95,7 +133,7 @@ PUB run_medium_loop() PUB run_slow_loop() - send_debug() + 'send_debug() slow_loop_counter++ PUB run_veryslow_loop() @@ -112,14 +150,21 @@ PUB init_variables() PUB setup_comms() - comm_debug.start(RX_DEBUG, TX_DEBUG, %0000, BAUDRATE_DEBUG) + 'comm_debug.start(RX_DEBUG, TX_DEBUG, %0000, BAUDRATE_DEBUG) comm_board.start(RX_COMM, TX_COMM, %0000, BAUDRATE_COMM) PUB send_sonar_packet() comm_board.str(string("$AA")) comm_board.fxdec(sequence_number,4) - comm_board.fxdec(1,2) ' Only 1 Sonar supported currently + comm_board.fxdec(MAX_NUMBER_SONARS,2) + 'comm_board.fxdec(distance0_mm,4) comm_board.fxdec(distance1_mm,4) + 'comm_board.fxdec(distance2_mm,4) + 'comm_board.fxdec(distance3_mm,4) + 'comm_board.fxdec(distance4_mm,4) + 'comm_board.fxdec(distance5_mm,4) + 'comm_board.fxdec(distance6_mm,4) + 'comm_board.fxdec(distance7_mm,4) comm_board.str(string(10,13)) if sequence_number >= 9999 sequence_number := 0 @@ -147,6 +192,7 @@ PUB send_dummy_sonar_packet() fakedistance_cm++ PUB send_debug() + comm_debug.fxdec(distance1_mm,4) comm_debug.str(string("Fast:")) comm_debug.dec(fast_loop_counter) comm_debug.str(string(" Med: ")) @@ -158,4 +204,11 @@ PUB send_debug() comm_debug.str(string(10,13)) PUB read_sonars() - distance1_mm := ping.millimeters(PIN_SONAR1) \ No newline at end of file + 'distance0_mm := ping.millimeters(PIN_SONAR0) + distance1_mm := ping.millimeters(PIN_SONAR1) + 'distance2_mm := ping.millimeters(PIN_SONAR2) + ' distance3_mm := ping.millimeters(PIN_SONAR3) + 'distance4_mm := ping.millimeters(PIN_SONAR4) + 'distance5_mm := ping.millimeters(PIN_SONAR5) + ' distance6_mm := ping.millimeters(PIN_SONAR6) + 'distance7_mm := ping.millimeters(PIN_SONAR7) \ No newline at end of file diff --git a/doc/Boards/ConnectBoard/elec/ConnectBoard/ConnectBoard.kicad_pcb b/doc/Boards/ConnectBoard/elec/ConnectBoard/ConnectBoard.kicad_pcb index 424d47e..1a47233 100644 --- a/doc/Boards/ConnectBoard/elec/ConnectBoard/ConnectBoard.kicad_pcb +++ b/doc/Boards/ConnectBoard/elec/ConnectBoard/ConnectBoard.kicad_pcb @@ -2,7 +2,7 @@ (general (thickness 1.6) - (drawings 22) + (drawings 57) (tracks 254) (zones 0) (modules 38) @@ -12,8 +12,8 @@ (page A4) (title_block (title "Prop 2 Sonar Connect Board") - (date 2025-03-25) - (rev Rev0) + (date 2025-04-08) + (rev Rev1) (company "FAST Robotics") ) @@ -683,7 +683,7 @@ (fp_text reference J0 (at 0 -2.33) (layer F.SilkS) hide (effects (font (size 1 1) (thickness 0.15))) ) - (fp_text value "Comm Port" (at 2.286 3.81 270 unlocked) (layer F.SilkS) + (fp_text value "Comm Port" (at 0.254 -2.032 unlocked) (layer F.SilkS) (effects (font (size 1 1) (thickness 0.15))) ) (fp_text user %R (at 0 3.81 90) (layer F.Fab) @@ -1985,13 +1985,118 @@ ) ) + (gr_text P2 (at 102.6414 62.7634) (layer F.SilkS) (tstamp 67F5CF4F) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P0 (at 102.6414 60.2234) (layer F.SilkS) (tstamp 67F5CF45) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P40 (at 136.4234 124.7394) (layer F.SilkS) (tstamp 67F5CF41) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P41 (at 136.4234 122.1994) (layer F.SilkS) (tstamp 67F5CF3A) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P42 (at 136.4234 119.4054) (layer F.SilkS) (tstamp 67F5CF36) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P43 (at 136.4234 116.8654) (layer F.SilkS) (tstamp 67F5CF32) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P44 (at 136.4234 114.5794) (layer F.SilkS) (tstamp 67F5CF2E) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P45 (at 136.4234 112.0394) (layer F.SilkS) (tstamp 67F5CF2A) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P46 (at 136.4234 109.4994) (layer F.SilkS) (tstamp 67F5CF26) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P47 (at 136.4234 106.9594) (layer F.SilkS) (tstamp 67F5CF22) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P48 (at 136.4234 97.5614) (layer F.SilkS) (tstamp 67F5CF1E) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P49 (at 136.4234 95.0214) (layer F.SilkS) (tstamp 67F5CF18) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P50 (at 136.4234 92.2274) (layer F.SilkS) (tstamp 67F5CF14) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P51 (at 136.4234 89.6874) (layer F.SilkS) (tstamp 67F5CF10) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P52 (at 136.4234 87.4014) (layer F.SilkS) (tstamp 67F5CF09) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P53 (at 136.4234 84.6074) (layer F.SilkS) (tstamp 67F5CF04) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P54 (at 136.4234 82.3214) (layer F.SilkS) (tstamp 67F5CEFF) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P55 (at 136.4234 79.7814) (layer F.SilkS) (tstamp 67F5CEFB) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P56 (at 136.6774 71.1454) (layer F.SilkS) (tstamp 67F5CEF7) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P57 (at 136.6774 68.6054) (layer F.SilkS) (tstamp 67F5CEF3) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P58 (at 136.6774 66.0654) (layer F.SilkS) (tstamp 67F5CEEF) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P59 (at 136.6774 63.5254) (layer F.SilkS) (tstamp 67F5CEEB) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P60 (at 136.6774 60.7314) (layer F.SilkS) (tstamp 67F5CEE8) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P61 (at 136.6774 58.1914) (layer F.SilkS) (tstamp 67F5CC97) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P62 (at 136.6774 55.6514) (layer F.SilkS) (tstamp 67F5CC88) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text P63 (at 136.6774 53.1114) (layer F.SilkS) (tstamp 67F5CC57) + (effects (font (size 0.8 0.8) (thickness 0.15))) + ) + (gr_text 5V (at 156.4894 131.3434) (layer F.SilkS) (tstamp 67F5CC34) + (effects (font (size 1 1) (thickness 0.25))) + ) + (gr_text 3.3V (at 150.1394 131.3434) (layer F.SilkS) (tstamp 67F5CC33) + (effects (font (size 1 1) (thickness 0.25))) + ) + (gr_text 3.3V (at 150.1394 103.9114) (layer F.SilkS) (tstamp 67F5CC0B) + (effects (font (size 1 1) (thickness 0.25))) + ) + (gr_text 5V (at 156.4894 103.9114) (layer F.SilkS) (tstamp 67F5CC0A) + (effects (font (size 1 1) (thickness 0.25))) + ) + (gr_text "S + -" (at 153.5504 126.5174) (layer F.SilkS) (tstamp 67F5CBFC) + (effects (font (size 1.25 1.25) (thickness 0.25))) + ) + (gr_text "S + -" (at 153.5504 99.3394) (layer F.SilkS) (tstamp 67F5CBF3) + (effects (font (size 1.25 1.25) (thickness 0.25))) + ) + (gr_text "S + -" (at 153.5504 73.1504) (layer F.SilkS) + (effects (font (size 1.25 1.25) (thickness 0.25))) + ) + (gr_text 5V (at 156.2354 77.4954) (layer F.SilkS) (tstamp 67F4F897) + (effects (font (size 1 1) (thickness 0.25))) + ) + (gr_text 3.3V (at 149.8854 77.4954) (layer F.SilkS) + (effects (font (size 1 1) (thickness 0.25))) + ) (gr_text M3 (at 128.0414 130.8354) (layer F.SilkS) (effects (font (size 1 1) (thickness 0.15))) ) (gr_text "DC Jack\nBelow" (at 119.1514 54.8894 90) (layer F.SilkS) (effects (font (size 1 1) (thickness 0.15))) ) - (gr_text "Propeller 2 Edge Breakout\nSonar Connect\nDPG 2025\nRev0" (at 94.7674 71.9074) (layer F.SilkS) + (gr_text "Propeller 2 Edge Breakout\nSonar Connect\nDPG 2025\nRev1" (at 94.7674 71.9074) (layer F.SilkS) (effects (font (size 1.5 1.5) (thickness 0.3)) (justify left)) ) (gr_text