Skip to content

Commit 9e6782f

Browse files
authored
Merge pull request #128 from vpython/bruce_fixes_nov_15_20
Bruce fixes for nov-15-2020
2 parents 6d5b631 + 1123841 commit 9e6782f

File tree

6 files changed

+184
-64
lines changed

6 files changed

+184
-64
lines changed

labextension/vpython/src/glowcommlab.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ export function createWebsocket(msg, serviceUrl) {
4040
var uri = msg.content.data.wsuri
4141
var url;
4242

43-
url = serviceUrl + port + uri;
43+
if (document.location.hostname.includes("localhost")){
44+
url = "ws://localhost:" + port + uri;
45+
}
46+
else {
47+
url = serviceUrl + port + uri;
48+
}
4449
ws = new WebSocket(url);
4550
ws.binaryType = "arraybuffer";
4651

@@ -612,11 +617,20 @@ function o2vec3(p) {
612617
function handler(data) {
613618
"use strict";
614619

615-
/*
616-
console.log('---------------')
617-
for (var d in data) {
618-
for (var i in data[d]) console.log(i, JSON.stringify(data[d][i]))
619-
}
620+
/*
621+
// Debugging what is sent from server:
622+
let found = false
623+
for (let d in data) {
624+
for (const i in data[d]) {
625+
if (!found) {
626+
found = true
627+
console.log('================')
628+
}
629+
if (found) {
630+
console.log(i, JSON.stringify(data[d][i]))
631+
}
632+
}
633+
}
620634
*/
621635

622636
if (data.cmds !== undefined && data.cmds.length > 0) handle_cmds(data.cmds)

vpython/rate_control.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def _sleep(dt):
6666
return
6767
tend = _clock()+dt
6868
while _clock() < tend:
69+
print (tend- _clock(),tend)
6970
pass
7071

7172
class simulateDelay:

vpython/vector.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ def adjust_up(oldaxis, newaxis, up, save_oldaxis): # adjust up when axis is chan
302302
return save_oldaxis
303303
if save_oldaxis is not None:
304304
# Restore saved oldaxis now that newaxis is nonzero
305-
oldaxis = save_oldaxis
305+
oldaxis._x = save_oldaxis._x # avoid creating a new vector
306+
oldaxis._y = save_oldaxis._y
307+
oldaxis._z = save_oldaxis._z
306308
save_oldaxis = None
307309
if newaxis.dot(up) != 0: # axis and up not orthogonal
308310
angle = oldaxis.diff_angle(newaxis)
@@ -318,7 +320,6 @@ def adjust_up(oldaxis, newaxis, up, save_oldaxis): # adjust up when axis is chan
318320
oldaxis._x = newaxis._x # avoid creating a new vector
319321
oldaxis._y = newaxis._y
320322
oldaxis._z = newaxis._z
321-
return save_oldaxis
322323

323324
def adjust_axis(oldup, newup, axis, save_oldup): # adjust axis when up is changed
324325
if abs(newup._x) + abs(newup._y) + abs(newup._z) == 0:

0 commit comments

Comments
 (0)