Feb 4, 2022 - OpenSim Docker V2 to V3

Since I’ve started playing with Herbal3d again (more on that later), I need to have an easy way of running my modified OpenSimulator instances. Thus, I’ve gone back and updated my old opensim-docker project.

I first updated from V1 to V2 by updating OpenSimulator configuration files to the latest versions and then reworking the code so it is easier to understand.

That last problem was that it was a muddle of which image was being created and which runtime configuration was to be used. So now there are clearly two images (found in the directories image-opensim and image-herbal3d) and there are multiple configurations for those images in the image directories.

I also debugged the SQL version so it properly creates a standalone region and connects to the separately spun up database container.

After working on V2, I have come to feel that the idea of putting the configuration and the secrets for the configuration into the Docker image is wrong.

Thus version 3 is born.

The plan is to fix docker-config to mount the config directory in the user’s space. The process then becomes to clone the repository, build your image, edit the configuration information in the config directory, and finally start the container.

Comments

Feb 4, 2022 - Notes on v-web Metaverse

There has been some discussion on adding metaverse selection to Vircadia-Web (here after “v-web”) and this note talks about how the existing code could be modified.

Currently (as of Feb 4, 2022), v-web has a default metaverse URL that is used to fetch the metaverse information and is used as the metaverse to log the user into. This default metaverse is specified in @Base/config.ts and is connected when the main view is mounted (in App.vue).

The real work connecting to a metaverse is in @Modules/Utility.metaverseConnectionSetup() which calls MetaverseMgr.metaverseFactory() to create a new metaverse connection class instance. This operation also has the side effect of making the network connection to the metaverse, setting the “active” metaverse, and updating the metaverse information in the Vue variable $store. So the overall effect of calling metaverseConnectionSetup() is to change the active metaverse and update all the display variables. The only work needed here is that the previous metaverse class instance is not saved or freed.

Looking at the user interface, there is a “Click to log in to metaverse” text at the top of the page. Clicking this opens the “Metaverse Login” dialog (@Components/dialogs/Login.vue). This dialog has fields for username and password. If this dialog has a “metaverse” field added that had the default metaverse URL preloaded then the user could enter a new metaverse URL if logging into a different metaverse. The action would be, when the user pressed “Login”, the code would check if the metaverse URL had changed and, if so, call metaverseConnectionSetup() with the new URL before logging in the user. This would change the active metaverse and set up the application to use the new metaverse (Explore and other operations use the active metaverse).

As a side note, @Base/config.ts has code to save some variables in the browser’s local storage. If the user is specifying a different default metaverse, there should be some place that does a Config.setItem(DEFAULT_METAVERSE_URL, newURL).

Comments

May 29, 2021 - ROS2 Sending Image

I don’t know why this is not documented better but…

While I was porting my old ROS2 Python test application to the newest ROS2 Foxy on my Raspberry Pi’s, I discovered that I needed to use OpenCV to capture images because picamera does not work in 64 bit](https://github.com/waveform80/picamera/issues/540) .

What’s not documented very well (and I spent several days figuring out) is that, after one has ported to OpenCV, converting an OpenCV image into a ROS2 message is not obvious. After a bunch of Google’ing, one discovers that the ROS2 folks have packaged all the magic into a module called CvBridge.

OpenCV keeps images in cv:im structures and converting that into a byte array that fits into the ROS2 message is tricky. Actually, what’s expected in a ROS2 image message is not documented very well so what works is hard to figure out in the first place.

The ROS2 developers have created some tools for the OpenCV users and one is a tool that converts OpenCV images into ROS2 image messages. So, the code ends up looking like:

from sensor_msgs.msg import Image
import cv2
from cv_bridge import CvBridge
...
self.bridge = CvBridge()
self.camera = cv2.VideoCapture(0)
self.frame_num = 0
self.publisher = self.create_publisher(Image, "topic", 10)
...
ret, frame = self.camera.read()
if ret == True:
    msg = self.bridge.cv2_to_imgmsg(frame, 'bgr8')
    msg.header.frame_id = str(self.frame_num)   # 'msg' is a ROS2 sensor_msgs/Image.msg
    self.frame_num += 1
    self.publisher.publish(msg)

That is, don’t try to create the image message yourself. Instead, rely on the CvBridge package to create the whole message and then fill it in with other information.

Comments

May 10, 2021 - Iamus Walkthrough

Since July of last year, I have been coding a metaverse-server for the Vircadia virtual worlds. The Iamus metaverse-server acts as the coordination point for the independent domain-servers which host the virtual world space.

When High Fidelity open-sourced the code for their virtual world, they kept the central coordination services private so a new service for accounts and discovery was needed.

I created Iamus with NodeJS, ExpressJS, and MongoDB.

For anyone picking up the project and making modifications, there is written documentation on the server’s design, building, running, running as a Docker image, and various notes.

In addition to the written documentation, I created a video walking through the internals of the code:

This should give anyone modifying Iamus an good start.

Comments