3
$\begingroup$

I have built a little 'smart' robot using a Raspberry Pi and Arduino. Currently it can move around, sense obstacles, determine if it can pass, etc. My biggest problem so far is that it is completely "in the moment" and doesn't remember that there was a wall on its left once it's not sensing it. I'd like it to remember there was a wall on its left and so on so I thought, maybe I could use Blender for its visual memory!

Is it possible to add/manipulate meshes in a blend file outside of Blender via Python? My robot's code is in Python but I suppose if I have to use C for it, I can just write a Python wrapper. I don't expect to generate high detail meshes or anything like that, just cubes so I can inspect what obstacles it's remembering.

$\endgroup$
3
  • $\begingroup$ possible duplicate of How to pass command line arguments to a Blender python script? $\endgroup$ Commented Jan 20, 2015 at 16:26
  • $\begingroup$ Hmmm. I didn't think of command line args but wouldn't the problem with this be that a new instance of blender would need to run every time i wanted to add a new object to the blend file? Currently everything I'm doing is command line but i do have a desktop environment on this distro so i dunno if that would work. Maybe if i could send command line args to the current open instance of blender? $\endgroup$
    – Mungoid
    Commented Jan 20, 2015 at 16:45
  • $\begingroup$ As far as I know, the 2 ways to add data to a blender scene that isn't open is by passing arguments and/or by running a script via command line, as that duplicate question shows. If you are saying that you can have blender open, then that seems like a different question. There are quite a few arduino questions here on SE. $\endgroup$ Commented Jan 20, 2015 at 16:52

2 Answers 2

2
$\begingroup$

You can also build bpy as a standalone module using cmake, and use it in a python script with import bpy This is pretty similar to doing blender -b -P customscript.py

$\endgroup$
2
  • $\begingroup$ Hmm, very interesting. I did a little looking and i found this: wiki.blender.org/index.php/User:Ideasman42/BlenderAsPyModule - It seems to be pretty much what you are suggesting. I may have to toy around with this idea some! $\endgroup$
    – Mungoid
    Commented Jan 20, 2015 at 20:06
  • $\begingroup$ So i managed to get this working after a few days of headache. Definitely not simple but it seems to do what i was looking for. Marking as answer =-) $\endgroup$
    – Mungoid
    Commented Jan 23, 2015 at 18:56
1
$\begingroup$

I can imagine some server-client solution like code running inside blender listening for robot(s) input and creating meshes etc. according to incoming data. The robot(s) could then request info from the master blender code.

This is an idea, the technical aspect will be more difficult, like what protocol to use, how to implement server side (some code loop) inside blender (listening for callbacks and updating will be challenging).

Actually are you sure you need blender for this? Your robot probably doesn't have 3D range-finder so you can create the environment maps in some custom app in 2D from top-view. Start small and then build up.

$\endgroup$
1
  • $\begingroup$ Nah, technically i dont really need blender for it but I am more familiar with editing with blender/python than plotting and reading a 2d map. I hadnt really thought about a client/server kinda thing but I may look into that a little as it might be kinda neat to have a 'central brain' =-) $\endgroup$
    – Mungoid
    Commented Jan 20, 2015 at 20:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .