I wanted to share because I think it’s really cool that the flexibility of panda3d allows for doing basically anything!
This is a 2D game window where I’m plotting data from an embedded IMU through a USB serial port and making a realtime plot which is scrolling across the screen. I tried this with matplotlib first it was sooooo slooooow. Panda3D is superfast and looks amazing while doing it!
Next up: somehow get renderpipeline to work for the main project
6 Likes
Would love to see what techniques in Panda 3D that you used to do this!
Pretty simple, creating an array of position values from the serial port data, once the array is full we remove the oldest value to make room for the new values.
The entire graph is drawn every frame.
Using LineSegs() to draw the lines point by point with draw_to() and use them to create geoms and render with aspect2D.
This is where the magic happens, where the lines are used to generate the geoms.
self.accel_x_node.node().remove_all_geoms()
self.accel_x_node.node().add_geom(self.accel_x_lines.create().modify_geom(0))
1 Like
No problem!
Let me know if you have any more questions!
1 Like
That looks great. I may be attempting something similar involving telemetry handling. Are you reading your IMU data from the USB using python or do you have some C++ routines for that (or e.g. for doing quaternion math)? Where is your bottleneck?
I’m using python for everything, reading from USB etc. Panda3d runs very fast, no bottleneck that ive found so far… i suppose either the framerate or the usb communication
1 Like