Browse Source

forgot to add new files...

Vincenz Mechler 5 years ago
parent
commit
a2347a615c

+ 30 - 0
SketchAssistant/SketchAssistant/test_input_files/all.svg

@@ -0,0 +1,30 @@
+fsfwefafaefcSC
+F
+S
+FSFewFAHBfAg
+<DSFVSF>
+<GSG FS02MAFfm="Fmseikf" />
+source: https://www.w3schools.com/
+<svg height="500" width="500">
+  <polygon points="220,10 300,210 170,250 123,234" style="fill:lime;stroke:purple;stroke-width:1" />
+  <polyline points="20,20 40,25 60,40 80,120 120,140 200,180"
+  style="fill:none;stroke:black;stroke-width:3" />
+    <line x1="0" y1="0" x2="200" y2="200" style="stroke:rgb(255,0,0);stroke-width:2" />
+  <rect x="50" y="20" width="150" height="150"
+  style="fill:blue;stroke:pink;stroke-width:5;fill-opacity:0.1;stroke-opacity:0.9" />
+  <rect x="352.324" y="311.765" fill="#5486F7" width="4" height="128"/>
+  <rect x="478.871" y="266.351" fill="#FFFFFF" width="12" height="12"/>
+  <ellipse cx="250" cy="250" rx="100" ry="50"
+  style="fill:yellow;stroke:purple;stroke-width:2" />
+  <ellipse cx="240" cy="100" rx="220" ry="30" style="fill:purple" />
+  <ellipse cx="220" cy="70" rx="190" ry="20" style="fill:lime" />
+  <ellipse cx="210" cy="45" rx="170" ry="15" style="fill:yellow" />
+  <path id="lineAB" d="M 100 350 l 150 -300" stroke="red"
+  stroke-width="3" fill="none" />
+  <path id="lineBC" d="M 250 50 l 150 300" stroke="red"
+  stroke-width="3" fill="none" />
+  <path d="M 175 200 l 150 0" stroke="green" stroke-width="3"
+  fill="none" />
+  <path d="M 100 350 q 150 -300 300 0" stroke="blue"
+  stroke-width="5" fill="none" />
+</svg>

+ 35 - 0
SketchAssistant/SketchAssistantWPF/DLLs/Motorheader/Actuator.h

@@ -0,0 +1,35 @@
+/*
+ *  Actuator.h
+ *
+ *  Copyright (C)
+ *  Honda Research Institute Europe GmbH
+ *  Carl-Legien-Str. 30
+ *  63073 Offenbach/Main
+ *  Germany
+ *
+ *  UNPUBLISHED PROPRIETARY MATERIAL.
+ *  ALL RIGHTS RESERVED.
+ *
+ */
+#pragma once
+#include <stdbool.h>
+#include <stdint.h>
+#include <ctime>
+//#include <time.h>
+
+
+
+typedef struct Actuator
+{
+    bool active;
+    bool continuous;
+	clock_t endTime;
+    float intensity;
+    float minIntensity; // Cut off values under threshold (default: 0)
+    float maxIntensity; // Cut off values over threshold  (default: 1)
+    uint16_t frequency; // 250Hz, for Pacinian corpuscles use 200-300Hz
+} Actuator;
+
+void Actuator_setModeOnce(Actuator* actuator, float intensity, uint64_t duration);
+void Actuator_setModeContinuous(Actuator* actuator, float intensity);
+void Actuator_setModeStop(Actuator* actuator);

+ 81 - 0
SketchAssistant/SketchAssistantWPF/DLLs/Motorheader/ArduinoHub.h

@@ -0,0 +1,81 @@
+/*
+ *  ArduinoHub.h
+ *
+ *  Copyright (C)
+ *  Honda Research Institute Europe GmbH
+ *  Carl-Legien-Str. 30
+ *  63073 Offenbach/Main
+ *  Germany
+ *
+ *  UNPUBLISHED PROPRIETARY MATERIAL.
+ *  ALL RIGHTS RESERVED.
+ *
+ */
+
+#pragma once
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <ctime>
+//#include <windows.h>
+#include "Serial.h"
+#include "Actuator.h"
+
+typedef enum
+{
+    ARDUINOHUB_TYPE_PIEZO = 'P',
+    ARDUINOHUB_TYPE_ERM   = 'E',
+    ARDUINOHUB_TYPE_EMS   = 'M'
+} ArduinoHub_Type;
+
+typedef struct ArduinoHub
+{
+    bool valid;
+    pthread_mutex_t mutex;
+    pthread_t thread;
+    ArduinoHub_Type arduinoType;
+    Serial* serial;
+    Actuator* actuators;
+} ArduinoHub;
+
+ArduinoHub* ArduinoHub_new();
+void ArduinoHub_init(ArduinoHub* self, char* port, ArduinoHub_Type type);
+void ArduinoHub_clear(ArduinoHub* self);
+void ArduinoHub_delete(ArduinoHub* self);
+
+
+/**
+ * Starts vibration for a specified duration. The command is non-blocking.
+ * @intensity:
+ *      Intensity covering the whole spectrum of the actuator if no range is set.
+ *      An intensity range can be set with ArduinoHub_setIntensityRange().
+ * @duration:
+ *      Duration of the vibration in milliseconds.
+ */
+void ArduinoHub_vibrate(ArduinoHub* self, uint8_t tactor, float intensity, uint64_t duration);
+
+/**
+ * Starts continuous vibration. The command is non-blocking.
+ * @intensity:
+ *      Intensity covering the whole spectrum of the actuator if no range is set.
+ *      An intensity range can be set with ArduinoActuator_setIntensityRange().
+ */
+void ArduinoHub_startVibration(ArduinoHub* self, uint8_t tactor, float intensity);
+
+/**
+ * Stops continuous vibration.
+ */
+void ArduinoHub_stopVibration(ArduinoHub* self, uint8_t tactor);
+
+/**
+* Sets the frequency of the vibration of all piezo actuators.
+* No effect for ERM and EMS.
+*/
+void ArduinoHub_setFrequency(ArduinoHub* self, uint8_t tactor, uint16_t frequency);
+
+/**
+ * Set the intensity range. The default range is the actuators whole intensity [0, 1].
+ * Modifying this setting cuts-out intensity values under min and above max.
+ * E.g., for the range [0.2, 1.0] the intensity 0.5 maps to a device intensity of 0.6.
+ */
+void ArduinoHub_setIntensityRange(ArduinoHub* self, uint8_t tactor, float minIntensity, float maxIntensity);

+ 135 - 0
SketchAssistant/SketchAssistantWPF/DLLs/Motorheader/BodyActuator.h

@@ -0,0 +1,135 @@
+/*
+
+ *  BodyActuator.h
+
+ *
+
+ *  Copyright (C)
+
+ *  Honda Research Institute Europe GmbH
+
+ *  Carl-Legien-Str. 30
+
+ *  63073 Offenbach/Main
+
+ *  Germany
+
+ *
+
+ *  UNPUBLISHED PROPRIETARY MATERIAL.
+
+ *  ALL RIGHTS RESERVED.
+
+ *
+
+ */
+
+#pragma once
+
+#include <stdbool.h>
+
+#include "ArduinoHub.h"
+
+#include "EAIHub.h"
+
+typedef enum
+
+{
+
+    BODYACTUATOR_TYPE_NONE,
+
+    BODYACTUATOR_TYPE_EAI,
+
+    BODYACTUATOR_TYPE_PIEZO,
+
+    BODYACTUATOR_TYPE_ERM,
+
+    BODYACTUATOR_TYPE_EMS
+
+} BodyActuator_Type;
+
+extern char* BodyActuator_Type_Names[5];
+
+typedef struct BodyActuator
+
+{
+
+    bool valid;
+
+    uint8_t actuatorCount;
+
+    BodyActuator_Type type;
+
+    ArduinoHub* arduinoHub;
+
+    EAIHub* eaiHub;
+
+} BodyActuator;
+
+BodyActuator* BodyActuator_new();
+
+void BodyActuator_init(BodyActuator* self, BodyActuator_Type type, char* port, uint8_t actuatorCount);
+
+void BodyActuator_clear(BodyActuator* self);
+
+void BodyActuator_delete(BodyActuator* self);
+
+/**
+
+ * Starts actuation for a specified duration. The command is non-blocking.
+
+ * @intensity:
+
+ *      Intensity covering the whole spectrum of the actuator if no range is set.
+
+ *      An intensity range can be set with BodyActuator_setIntensityRange().
+
+ * @duration:
+
+ *      Duration of the vibration in milliseconds.
+
+ */
+
+void BodyActuator_actuate(BodyActuator* self, uint8_t tactor, double intensity, uint64_t duration);
+
+/**
+
+ * Starts continuous actuation. The command is non-blocking.
+
+ * @intensity:
+
+ *      Intensity covering the whole spectrum of the actuator if no range is set.
+
+ *      An intensity range can be set with ArduinoActuator_setIntensityRange().
+
+ */
+
+void BodyActuator_startActuation(BodyActuator* self, uint8_t tactor, double intensity);
+
+/**
+
+ * Stops continuous vibration.
+
+ */
+
+void BodyActuator_stopActuation(BodyActuator* self, uint8_t tactor);
+
+/**
+
+* Sets the frequency of the vibration of an actuator.
+
+*/
+
+void BodyActuator_setFrequency(BodyActuator* self, uint8_t tactor, uint16_t frequency);
+
+/**
+
+ * Set the intensity range. The default range is the actuators whole intensity [0, 1].
+
+ * Modifying this setting cuts-out intensity values under min and above max.
+
+ * E.g., for the range [0.2, 1.0] the intensity 0.5 maps to a device intensity of 0.6.
+
+ */
+
+void BodyActuator_setIntensityRange(BodyActuator* self, uint8_t tactor, double minIntensity, double maxIntensity);

+ 70 - 0
SketchAssistant/SketchAssistantWPF/DLLs/Motorheader/EAIHub.h

@@ -0,0 +1,70 @@
+/*
+ *  EAIHub.h
+ *
+ *  Copyright (C)
+ *  Honda Research Institute Europe GmbH
+ *  Carl-Legien-Str. 30
+ *  63073 Offenbach/Main
+ *  Germany
+ *
+ *  UNPUBLISHED PROPRIETARY MATERIAL.
+ *  ALL RIGHTS RESERVED.
+ *
+ */
+
+#pragma once
+#include <stdbool.h>
+#include <stdint.h>
+#include <ctime>
+#include <pthread.h>
+#include "Actuator.h"
+
+typedef struct EAIHub
+{
+    bool valid;
+    pthread_mutex_t mutex;
+    pthread_t thread;
+    Actuator* actuators;
+    uint16_t tactorType;
+    uint16_t modulation; // Default: 250Hz
+    int deviceID;
+} EAIHub;
+
+EAIHub* EAIHub_new();
+void EAIHub_init(EAIHub* self, char* eaiPort);
+void EAIHub_clear(EAIHub* self);
+void EAIHub_delete(EAIHub* self);
+
+/**
+ * Starts vibration for a specified duration. The command is non-blocking.
+ * @intensity:
+ *      Intensity covering the whole spectrum of the actuator if no range is set.
+ *      An intensity range can be set with EAIHub_setIntensityRange().
+ * @duration:
+ *      Duration of the vibration in milliseconds.
+ */
+void EAIHub_vibrate(EAIHub* self, uint8_t tactor, float intensity, uint64_t duration);
+
+/**
+ * Starts continuous vibration. The command is non-blocking.
+ * @intensity:
+ *      Intensity covering the whole spectrum of the actuator if no range is set.
+ *      An intensity range can be set with ArduinoActuator_setIntensityRange().
+ */
+void EAIHub_startVibration(EAIHub* self, uint8_t tactor, float intensity);
+
+/**
+ * Stops continuous vibration.
+ */
+void EAIHub_stopVibration(EAIHub* self, uint8_t tactor);
+
+/**
+* Sets the frequency of the vibration of an actuator.
+*/
+void EAIHub_setFrequency(EAIHub* self, uint8_t tactor, uint16_t frequency);
+/**
+ * Set the intensity range. The default range is the actuators whole intensity [0, 1].
+ * Modifying this setting cuts-out intensity values under min and above max.
+ * E.g., for the range [0.2, 1.0] the intensity 0.5 maps to a device intensity of 0.6.
+ */
+void EAIHub_setIntensityRange(EAIHub* self, uint8_t tactor, float minIntensity, float maxIntensity);

+ 33 - 0
SketchAssistant/SketchAssistantWPF/DLLs/Motorheader/Serial.h

@@ -0,0 +1,33 @@
+/*
+ *  Serial.h
+ *
+ *  Copyright (C)
+ *  Honda Research Institute Europe GmbH
+ *  Carl-Legien-Str. 30
+ *  63073 Offenbach/Main
+ *  Germany
+ *
+ *  UNPUBLISHED PROPRIETARY MATERIAL.
+ *  ALL RIGHTS RESERVED.
+ *
+ */
+
+#pragma once
+#include <stdbool.h>
+#include <stdint.h>
+#include <windows.h>
+
+typedef struct Serial
+{
+    bool valid;
+    char* port;
+    HANDLE hComm;
+    bool serialStatus;
+} Serial;
+
+Serial* Serial_new();
+void Serial_init(Serial* self, char* port);
+void Serial_clear(Serial* self);
+void Serial_delete(Serial* self);
+
+void Serial_sendMessage(Serial* self, unsigned char* message, int size);

+ 25 - 0
SketchAssistant/SketchAssistantWPF/LocalArmbandInterface.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Runtime.InteropServices;
+
+namespace SketchAssistantWPF
+{
+    class LocalArmbandInterface
+    {
+
+        [DllImport (@"StaticLibMotors.dll")]
+        public static extern int setupArmband();
+
+        [DllImport(@"StaticLibMotors.dll")]
+        public static extern void startVibrate(int motorNumber, float intensity);
+
+        [DllImport(@"StaticLibMotors.dll")]
+        public static extern void stopVibration(int motorNumber);
+
+        //public void Vibrate()
+
+    }
+}

BIN
SketchAssistant/SketchAssistantWPF/StaticLibMotors.dll


+ 35 - 0
SketchAssistant/StaticLib1/ArmbandInterface.h

@@ -0,0 +1,35 @@
+#pragma once
+#include "stdafx.h"
+extern "C" {
+#include "MotorHeader/BodyActuator.h"
+}
+#include <ctime>
+#include <stdio.h>
+#define DllExport extern "C" __declspec( dllexport )
+
+
+
+DllExport int setupArmband();
+DllExport void startVibrate(int tactor, float intensity);
+DllExport void stopVibrate(int tactor);
+
+class ArmbandInterface
+{
+
+	static BodyActuator* armband;
+	//static char *port = 
+
+	static HINSTANCE lib;
+	typedef void(__cdecl *InitFunctionType)(BodyActuator*, BodyActuator_Type, char*, int);
+	static InitFunctionType initFunctionHandle;
+	typedef void(__cdecl *StartFunctionType)(BodyActuator*, uint8_t, float);
+	static StartFunctionType startFunctionHandle;
+	typedef void(__cdecl *StopFunctionType)(BodyActuator*, uint8_t);
+	static StopFunctionType stopFunctionHandle;
+
+	public:
+		__declspec(dllexport) int __cdecl  setupArmband();
+		__declspec(dllexport) void __cdecl startVibrate(int tactor, float intensity);
+		__declspec(dllexport) void __cdecl stopVibrate(int tactor);
+		void setupMotors();
+};

BIN
SketchAssistant/StaticLib1/BodyActuator.dll


BIN
SketchAssistant/StaticLib1/TActionManager.dll


BIN
SketchAssistant/StaticLib1/TactorInterface.dll


BIN
SketchAssistant/StaticLib1/eai_common.dll


BIN
SketchAssistant/StaticLib1/eai_serial.dll


BIN
SketchAssistant/StaticLib1/eai_winbluetooth.dll


BIN
SketchAssistant/StaticLib1/eai_winusb.dll