diff --git a/EscapeTheGhost/Assets/Cellulo.cs b/EscapeTheGhost/Assets/Cellulo.cs index 340f027..673113c 100644 --- a/EscapeTheGhost/Assets/Cellulo.cs +++ b/EscapeTheGhost/Assets/Cellulo.cs @@ -1,124 +1,124 @@ using UnityEngine; using System.Collections; using System.Runtime.InteropServices; public class Cellulo { // id inside the library private long id; // constructor: connect to robot public Cellulo(string macAddr, string localAdapterMacAddr) { id = newRobot(); setLocalAdapterMacAddr(id, localAdapterMacAddr); setMacAddr(id, macAddr); connectToServer(id); } // disconnect from robot on exit ~Cellulo() { destroyRobot(id); } // Cellulo methods export below... [DllImport ("cellulo-unity")] private static extern long newRobot(); [DllImport ("cellulo-unity")] private static extern void destroyRobot(long id); [DllImport ("cellulo-unity")] private static extern void setLocalAdapterMacAddr(long robot, string localAdapterMacAddr); [DllImport ("cellulo-unity")] private static extern void setAutoConnect(long robot, long autoConnect); [DllImport ("cellulo-unity")] private static extern void setMacAddr(long robot, string macAddr); [DllImport ("cellulo-unity")] private static extern void connectToServer(long robot); [DllImport ("cellulo-unity")] private static extern void setGoalVelocity(long robot, float vx, float vy, float w); public void setGoalVelocity(float vx, float vy, float w) { - setGoalVelocity(id, vx, vy, w); + setGoalVelocity(id, vx, -vy, w); } [DllImport ("cellulo-unity")] private static extern void setGoalPose(long robot, float x, float y, float theta, float v, float w); public void setGoalPose(float x, float y, float theta, float v, float w) { - setGoalPose(id, x, y, theta, v, w); + setGoalPose(id, x, -y, theta, v, w); } [DllImport ("cellulo-unity")] private static extern void setGoalPosition(long robot, float x, float y, float v); public void setGoalPosition(float x, float y, float v) { - setGoalPosition(id, x, y, v); + setGoalPosition(id, x, -y, v); } [DllImport ("cellulo-unity")] private static extern void clearTracking(long robot); public void clearTracking() { clearTracking(id); } [DllImport ("cellulo-unity")] private static extern void clearHapticFeedback(long robot); public void clearHapticFeedback() { clearHapticFeedback(id); } [DllImport ("cellulo-unity")] private static extern void setVisualEffect(long robot, long effect, long r, long g, long b, long value); public void setVisualEffect(long effect, long r, long g, long b, long value) { setVisualEffect(id, effect, r, g, b, value); } [DllImport ("cellulo-unity")] private static extern void setCasualBackdriveAssistEnabled(long robot, long enabled); public void setCasualBackdriveAssistEnabled(long enabled) { setCasualBackdriveAssistEnabled(id, enabled); } [DllImport ("cellulo-unity")] private static extern void setHapticBackdriveAssist(long robot, float xAssist, float yAssist, float thetaAssist); public void setHapticBackdriveAssist(float xAssist, float yAssist, float thetaAssist) { setHapticBackdriveAssist(id, xAssist, yAssist, thetaAssist); } [DllImport ("cellulo-unity")] private static extern void reset(long robot); public void reset() { reset(id); } [DllImport ("cellulo-unity")] private static extern void simpleVibrate(long robot, float iX, float iY, float iTheta, long period, long duration); public void simpleVibrate(float iX, float iY, float iTheta, long period, long duration) { simpleVibrate(id, iX, iY, iTheta, period, duration); } [DllImport ("cellulo-unity")] private static extern float getX(long robot); public float getX() { return getX(id); } [DllImport ("cellulo-unity")] private static extern float getY(long robot); public float getY() { // Unity's y is up return -getY(id); } [DllImport ("cellulo-unity")] private static extern float getTheta(long robot); public float getTheta() { return getTheta(id); } [DllImport ("cellulo-unity")] private static extern long getKidnapped(long robot); public long getKidnapped() { return getKidnapped(id); } }