diff --git a/Teensy/lib/nanopb/UART.pb.c b/Teensy/lib/nanopb/UART.pb.c index 7efbb54..d59a716 100644 --- a/Teensy/lib/nanopb/UART.pb.c +++ b/Teensy/lib/nanopb/UART.pb.c @@ -1,5 +1,5 @@ /* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.3.9.3 at Mon Jul 13 23:03:26 2020. */ +/* Generated by nanopb-0.3.9.3 at Sun Jul 19 20:45:16 2020. */ #include "UART.pb.h" diff --git a/Teensy/lib/nanopb/UART.pb.h b/Teensy/lib/nanopb/UART.pb.h index 50c15f6..e96ffcd 100644 --- a/Teensy/lib/nanopb/UART.pb.h +++ b/Teensy/lib/nanopb/UART.pb.h @@ -1,5 +1,5 @@ /* Automatically generated nanopb header */ -/* Generated by nanopb-0.3.9.3 at Mon Jul 13 23:03:26 2020. */ +/* Generated by nanopb-0.3.9.3 at Sun Jul 19 20:45:16 2020. */ #ifndef PB_UART_PB_H_INCLUDED #define PB_UART_PB_H_INCLUDED diff --git a/omicam/src/defines.h b/omicam/src/defines.h index c69a1db..ef5eb94 100644 --- a/omicam/src/defines.h +++ b/omicam/src/defines.h @@ -6,7 +6,7 @@ /** Omicam will be running locally on a PC for debugging. Uses test imagery and some features are disabled. */ #define BUILD_TARGET_PC 1 /** which platform Omicam will be running on */ -#define BUILD_TARGET (BUILD_TARGET_PC) +#define BUILD_TARGET (BUILD_TARGET_SBC) /** * Version history: @@ -45,11 +45,11 @@ #define VISION_LOAD_TEST_VIDEO 0 /** send a debug frame every N real frames */ -#define REMOTE_FRAME_INTERVAL 1 +#define REMOTE_FRAME_INTERVAL 2 /** quality of remote debugger JPEG, 0 being the worst and 100 being the best */ -#define REMOTE_JPEG_QUALITY 75 +#define REMOTE_JPEG_QUALITY 60 /** zlib compression level for threshold masks, 0 being cheapest and 10 being most expensive */ -#define REMOTE_COMPRESS_LEVEL 6 +#define REMOTE_COMPRESS_LEVEL 7 /** which port the remote debug TCP server runs on */ #define REMOTE_PORT 42708 /** whether or not remote debug is enabled */ @@ -88,7 +88,7 @@ /** Whether or not to use a moving average to smooth the localiser output. Recommended due to noise. */ #define LOCALISER_ENABLE_SMOOTHING 1 /** The size of the moving average history for smoothing, larger values mean smoother but less precision. */ -#define LOCALISER_SMOOTHING_SIZE 16 +#define LOCALISER_SMOOTHING_SIZE 64 /** If true, smooths using the moving median instead of the moving average */ #define LOCALISER_SMOOTHING_MEDIAN 0 /** If true, the localiser uses the mouse sensor for initial estimate calculation. If false, it only uses the goals. */ diff --git a/omicontrol/src/main/kotlin/com/omicron/omicontrol/Values.kt b/omicontrol/src/main/kotlin/com/omicron/omicontrol/Values.kt index 216dea6..487fd7e 100644 --- a/omicontrol/src/main/kotlin/com/omicron/omicontrol/Values.kt +++ b/omicontrol/src/main/kotlin/com/omicron/omicontrol/Values.kt @@ -19,7 +19,8 @@ import org.greenrobot.eventbus.EventBus * 3.5a: fixed some bugs, added some more tools to for debugging * 4.5b: Omicontrol enters beta, added support for hybrid localiser displays, fixed some bugs * 4.6b: added built-in mirror model calculation with exponential and polynomial (instead of CSV export) - * 4.7b: (WIP) added camera dewarp tool and frontend for obstacle detection and robot orientation + * 4.7b: added camera dewarp tool and frontend for obstacle detection and robot orientation + * 4.8b: (WIP) ??? */ const val OMICONTROL_VERSION = "4.7b" const val DEFAULT_IP = "192.168.12.1" diff --git a/omicontrol/src/main/kotlin/com/omicron/omicontrol/views/FieldView.kt b/omicontrol/src/main/kotlin/com/omicron/omicontrol/views/FieldView.kt index facb6bb..5511f5f 100644 --- a/omicontrol/src/main/kotlin/com/omicron/omicontrol/views/FieldView.kt +++ b/omicontrol/src/main/kotlin/com/omicron/omicontrol/views/FieldView.kt @@ -6,15 +6,18 @@ import com.omicron.omicontrol.field.FieldObject import com.omicron.omicontrol.field.Robot import javafx.geometry.Point2D import javafx.geometry.Pos +import javafx.scene.SnapshotParameters import javafx.scene.canvas.GraphicsContext import javafx.scene.control.Alert import javafx.scene.control.Label import javafx.scene.image.Image +import javafx.scene.image.ImageView import javafx.scene.input.KeyCode import javafx.scene.input.KeyCodeCombination import javafx.scene.input.KeyCombination import javafx.scene.layout.Priority import javafx.scene.paint.Color +import javafx.scene.transform.Rotate import org.apache.commons.io.FileUtils import org.greenrobot.eventbus.Subscribe import org.tinylog.kotlin.Logger @@ -24,6 +27,7 @@ import kotlin.math.roundToInt import kotlin.math.sin import kotlin.system.exitProcess + /** * This screen displays the localised positions of the robots on a virtual field and allows you to control them * @param isOffline if true, we are loading a replay from disk, otherwise we are connected to the robot @@ -35,9 +39,9 @@ class FieldView(private val isOffline: Boolean = false) : View() { private lateinit var ballLabel: Label private val fieldImage = Image("field_cropped_scaled.png") private val targetIcon = Image("target.png") - private val robotDefaultSprite = Image("robot.png") - private val robotUnknownSprite = Image("robot_unknown2.png") - private val robotSelectedSprite = Image("robot_selected.png") + private val robotDefaultSprite = ImageView(Image("robot.png", ROBOT_CANVAS_DIAMETER, ROBOT_CANVAS_DIAMETER, false, true)) + private val robotUnknownSprite = ImageView(Image("robot_unknown2.png", ROBOT_CANVAS_DIAMETER, ROBOT_CANVAS_DIAMETER, false, true)) + private val robotSelectedSprite = ImageView(Image("robot_selected.png", ROBOT_CANVAS_DIAMETER, ROBOT_CANVAS_DIAMETER, false, true)) private lateinit var localiserPerfLabel: Label private val robots = listOf( Robot(0), @@ -126,9 +130,15 @@ class FieldView(private val isOffline: Boolean = false) : View() { val half = ROBOT_CANVAS_DIAMETER / 2.0 val pos = robot.position.toCanvasPosition() val sprite = if (selectedRobot == robot) robotSelectedSprite else if (robot.isPositionKnown) robotDefaultSprite else robotUnknownSprite + sprite.rotate = robot.orientation.toDouble() + + // this is dumb, source: https://stackoverflow.com/a/33618088/5007892 + val params = SnapshotParameters() + params.fill = Color.TRANSPARENT + val rotatedImage = sprite.snapshot(params, null) display.globalAlpha = if (isReduceTransparency) 0.3 else 1.0 - display.drawImage(sprite, pos.x - half, pos.y - half, ROBOT_CANVAS_DIAMETER, ROBOT_CANVAS_DIAMETER) + display.drawImage(rotatedImage, pos.x - half, pos.y - half) display.globalAlpha = 1.0 display.fill = Color.MAGENTA diff --git a/omicontrol/src/main/resources/test_data/frame10.jpg b/omicontrol/src/main/resources/test_data/frame10.jpg new file mode 100644 index 0000000..4c7b587 Binary files /dev/null and b/omicontrol/src/main/resources/test_data/frame10.jpg differ diff --git a/omicontrol/src/main/resources/test_data/frame11_edgecase.jpg b/omicontrol/src/main/resources/test_data/frame11_edgecase.jpg new file mode 100644 index 0000000..0fc54ed Binary files /dev/null and b/omicontrol/src/main/resources/test_data/frame11_edgecase.jpg differ diff --git a/omicontrol/src/main/resources/test_data/frame12_edgecase.jpg b/omicontrol/src/main/resources/test_data/frame12_edgecase.jpg new file mode 100644 index 0000000..4261a62 Binary files /dev/null and b/omicontrol/src/main/resources/test_data/frame12_edgecase.jpg differ