Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
BenoitGeslain committed Mar 8, 2024
1 parent 62508b5 commit 1bac519
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 358983253}
m_Enabled: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 51d618b1b4dddf44a8b914838ac6e9b6, type: 3}
m_Name:
Expand Down Expand Up @@ -1328,6 +1328,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bb5310432868de244b86ddcc9c3aa8c1, type: 3}
m_Name:
m_EditorClassIdentifier:
filename: C:\Users\ms-vr\projects\unity\toolkit\python\RedirectionPlotter.py
pythonPath: C:\Users\ms-vr\anaconda3\envs\plot\python.exe
--- !u!1 &398215666
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2427,6 +2429,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bb5310432868de244b86ddcc9c3aa8c1, type: 3}
m_Name:
m_EditorClassIdentifier:
filename:
pythonPath:
--- !u!1 &858473990
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class Socket : MonoBehaviour {
private TcpClient client;

[SerializeField] private string filename;
[SerializeField] private string pythonPath;

private Razzaque2001Hybrid loggingTechnique;

Expand All @@ -55,15 +56,17 @@ private void Start() {
InvokeRepeating(nameof(StartSendingMessages), 1f, 1f);
loggingTechnique = new();
redirectionData = new();

LaunchVisualizer();
}

public void LaunchVisualizer() {

Debug.Log("Launch visualizer");
Debug.Log($"Launch visualizer with Python {pythonPath}");
if (filename is null || !filename.EndsWith(".py")) return;
// TODO not great for non-windows
System.Diagnostics.Process p = new() {
StartInfo = new System.Diagnostics.ProcessStartInfo(@"python.exe", this.filename) {
StartInfo = new System.Diagnostics.ProcessStartInfo(pythonPath, this.filename) {
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
Expand All @@ -81,11 +84,11 @@ private void StartSendingMessages() {
catch (SocketException) { }
}
else {
redirectionData.overTime = 0f;
redirectionData.rotational = 0f;
redirectionData.curvature = 0f;
Thread thread = new(() => SendMessage(client, redirectionData));
thread.Start();
// redirectionData.overTime = 0f;
// redirectionData.rotational = 0f;
// redirectionData.curvature = 0f;
}
}

Expand Down

0 comments on commit 1bac519

Please sign in to comment.