So I’ve played a few hours of Colonial Marines and I have to say that the experience (as predicted by many) is underwhelming. It has changed a lot since the original promotion as a 4-player co-op class-based survival game (essentially Left 4 Dead but with aliens and pre-built loadouts). Let’s ignore the changes in direction though, as it has been a few years and even with the best intentions things do change. Let’s instead focus on the problems with the game as-is.
This post was prompted by a Twitter exchange with Cliff Harris (@cliffski), owner of Positech Games and creator of games such as Gratuitous Space Battles and Democracy 3. Cliff’s initial tweets (below) pointed out that Kickstarter might not be as useful to game developers as it seems.
This post looks into getting external functions working in OpenModelica and, to an extent, Dymola. There are a couple of approaches and I hope to give you a better idea of what to look out for when you come to implement your functions.
You may have noticed that my series on Modelica socket communication stalled somewhat after only one part. Originally, this post was going to be part 2 of the series, but it has become somewhat more general, so I’m posting it as a separate thing.
At the time of writing, Argos (a high-street retailer here in the UK) has a sale on DS games, including “Learn with Pokemon: typing adventure“. For someone that doesn’t play Pokemon games (and doesn’t need to learn how to type) this wouldn’t usually be of interest. However, the game in question has one very nice incentive to its purchase: a bundled-in Nintendo Bluetooth keyboard. At the sale price of £9 it would almost be crazy not to snap one up. You can easily pay £15-£25 for a no-name Bluetooth keyboard on Amazon, and I won’t even bring up Apple branded nonsense . This post is a quick review of the package and the keyboard. For reviews of the game itself, there are a few around the internet (note: I don’t have any affiliation with those sites, they were just the first results on Google).
I recently signed up to try the beta of Plotly (@plotlygraphs) and decided to try it out by plotting the temperature, CPU load and RAM usage of a Raspberry Pi. Temperature, particularly, was of interest to me as I intend to stream video from the camera module, which makes heavy use of both the GPU and CPU. Plotly provide a Python API, which suits me perfectly.
Now that I’ve demonstrated a method of using the OpenModelica CORBA interface to set up and run simulations, I will move on to a way of passing data out of and in to a running simulation (for example, to use a control algorithm that is more easily implemented in another language). I will use sockets for this as they are one of the simplest and most generic communication methods available.
The first step in setting up socket communication within a Modelica simulation is to create a socket library that can be called from the simulation code. Fortunately, this is very simple C code. You can find the relevant code here.
The final step in the process is to create a wrapper to allow easy programmatic control of OMC. I have posted a simple wrapper that provides the facilities required by the bouncing ball example here. It is not at the same level as the work by Ganeson et al. of course.
When compiling OpenModelica from source on Mint (and possibly on Ubuntu?) the compile cheat sheet in the readme gives working instructions with one exception: several packages, such as libqtwebkit-dev, aren’t installed when you run the sudo apt-get build-dep openmodelica step. I had to use the following commands from the text further down the readme to get everything needed:
sudo apt-get install antlr libantlr-dev
sudo apt-get install libreadline-dev libqt4-dev libqtwebkit-dev libqwt5-qt4-dev
sudo apt-get install sqlite3 libsqlite3-dev
Note that I had to use to libreadline-dev instead of libreadline5-dev. Either way, that particular package was already installed, but I’ve left it here for completeness as the others on the same line weren’t.
I also needed to install bison and flex for the testsuite (not mentioned in the build instructions).
There may be other packages required that I already had installed, so my advice would be to install all of the packages they suggest rather than relying on build-dep.
In part 1 I showed you how to get set up with the omniORB library/tools to communicate with OMC from Python. This post will show how to compile an IDL file to provide the appropriate interface to your script. This post assumes that the environment variables from last time are still set up and that you have OMC running with the +d=interactiveCorba parameter.
In this post I’m going to be walking through the process of setting up omniORB with Python for the purpose of interacting with the CORBA interface provided by the OpenModelica compiler (OMC). This allows OMC to be controlled from a Python script (loading simulations, changing parameters, etc). While the intention of this post is specifically that of interacting with OMC, the installation of omniORB will be the same in other situations. Note though that you may require additional setup in these other situations, for omniNames for example. I will be showing the setup process for Linux (and specifically, Mint/Ubuntu). I will assume that OpenModelica is already installed.