barbagroup / JITcode-MechE

Online learning modules to learn computing in a problem-based context within Mechanical Engineering
MIT License
7 stars 5 forks source link

Lesson 2 issues #16

Closed agolding718 closed 10 years ago

agolding718 commented 10 years ago

All,

I've got two things I want to work out about lesson two:

  1. Animation instead of series of plots for the maze navigation bit.
  2. How to get the scripts to "see" the workspace variables and functions.

Aron, I thought that you might have an idea, especially for the second one. Please feel free to contribute, everyone else; I've had a look around and haven't found what I'm looking for. Is there a way (different magic command?) to make the scripts I'm using recognize the existing variables? Thanks.

-Alex

ahmadia commented 10 years ago

Hi Alex,

The only to way to make the scripts recognize objects in the namespace correctly is to import them as functions. Why don't you leave this issue open and focus on the next lessons? I'll think more about how to do this.

gforsyth commented 10 years ago

Hi Alex,

I reworked the first maze example to use function calls and animate the results. Code is not commented at the moment, but it basically sends the student_func function as variable into your rover_planning_1 (reworked to act as a function), then saves the resulting maze configurations into an array called mazehist. mazehist gets passed to a quick animator function which then returns the results for display in the notebook.

You can see what it looks like here

I think this will work pretty well, it keeps enough advanced stuff behind the curtain, so to speak.

The animation does require the JSAnimation library (see here for installation instructions) but only for those us writing and running these notebooks. As you can see above, nbviewer just plays the embedded animation object without objection (on chromium, anyway)

The animation stuff is all on gforsyth/animaterover

agolding718 commented 10 years ago

Wow. that's awesome. Thanks; I'll get the rest of it working in a similar fashion.