0 penilaian0% menganggap dokumen ini bermanfaat (0 suara)
37 tayangan13 halaman
Blender is an open-source 3D modeling and animation software that can be used to create interactive simulations using real-world inputs. This document provides instructions on setting up Blender to receive serial input from a microprocessor like an Arduino. It outlines downloading and installing the necessary components - Blender, Python, and the PySerial library. It then provides sample code to send basic commands to an Arduino over serial to control an LED. With Blender, Python, PySerial set up correctly, this allows using real input to dynamically manipulate and visualize 3D models in real-time.
Blender is an open-source 3D modeling and animation software that can be used to create interactive simulations using real-world inputs. This document provides instructions on setting up Blender to receive serial input from a microprocessor like an Arduino. It outlines downloading and installing the necessary components - Blender, Python, and the PySerial library. It then provides sample code to send basic commands to an Arduino over serial to control an LED. With Blender, Python, PySerial set up correctly, this allows using real input to dynamically manipulate and visualize 3D models in real-time.
Blender is an open-source 3D modeling and animation software that can be used to create interactive simulations using real-world inputs. This document provides instructions on setting up Blender to receive serial input from a microprocessor like an Arduino. It outlines downloading and installing the necessary components - Blender, Python, and the PySerial library. It then provides sample code to send basic commands to an Arduino over serial to control an LED. With Blender, Python, PySerial set up correctly, this allows using real input to dynamically manipulate and visualize 3D models in real-time.
2.-"3-% !"(%$31#()$" ($ 2.-"3-% Blender is a 4%-- and $&-"56$1%#- 78 #$0&1(-% *%'&9)#6 6$4(:'%- &%$31#( used or creating animated ilms, isual eects, art, 3D printed models, interactie 3D applications and ideo games. Blender's eatures include 3D modeling, UV unwrapping, texturing, rigging and skinning, luid and smoke simulation, &'%()#.- 6)01.'()$"; 6$4( <$3= 6)01.'()$", sculpting, animating, match moing, camera tracking, rendering, ideo editing and compositing. It also eatures a built-in game engine. \ikipedia Commons
!3-' We were interested in using the simulation capabilities of blender and then manipulating the model with real world inputs... external system or microprocessor. Why? To be able to quickly see changes in model dynamics given real world control, input without having to retool or recreate a full scale system. Less cost, less material Blender gives awesome visual representations that stem from its strong background in the gaming industry.
Side note: We spent some quality time interpreting how to utilize the toolbox -44-#()?-.= Python in practice @9-%- 3$ ! *-( (9-6- G:-6$0- ($$.6A Blender is available at www.blender.org There are releases all the time as the open source community continually pushes advancements. We are using Version 2.49b in our demo
Python Typically is packaged with Mac, Linux systems Windows users will need to download and install Again, versions are released constantly We used the version that mated best with Blender 2.49b Python 2.6
Microprocessor We chose to use the Arduino UNO with our demo based on familiarity, availability, cost, and available support modules. You can grab the UNO from just about any electronics store these days for around $25. 8el[o 8aLllalnen Advanced MechaLronlcs 208 8afael erelra !"##$%& (#)*#"+ !,$+" !"#$%&$%'()"* ,-'. ()/- !"&0( )"($ 1.-"2-% 3)/0.'()$" 4"5)%$"/-"(
1hls gulde ls lnLended Lo glve you a llLLle lnslghL lnLo how Lo geL a blender model wlLh real-Llme serlal lnpuL up and runnlng. We wenL Lhrough a few hurdles durlng our lnvesLlgaLlon and wanL Lo help you avold Lhose so LhaL you can use Lhese Lools Lo Lhelr full poLenLlal. Youll need three software components to get things moving: Blender, Python, and PySerial. !"#$%#& First thing youll want to do is get a version of Blender. While typically the newest and coolest versions are Lhe way Lo go, for Lhls purpose we opLed Lo go wlLh 8lender verslon 2.49b whlch was bullL uslng yLhon 2.6, whlch also happens Lo colnclde wlLh Lhe verslon of ySerlal we used.
Co Lo www.8lender.org and download Lhe approprlaLe verslon for your operaLlng sysLem. 8lender 2.49b comes prepackaged wlLh and bullL upon yLhon 2.6.
!"#$% !'(#)'#*"* +,-'*.", /".0'(1%*#.2 345 !'6'") 7"1"#1' !"#$%& If youre using a Mac or Linux OS, youve likely got python installed already. Verify that the version youre using is at least as current as Python 2.6 89:( (1; (% '-%#, <%-#*= #*(% (0" *"> 7;(0%* ?@A 2"1#"2B #( <'; <'C" (0#*=2 <"22;D@ For windows users, youll need to travel over to >>>@E;(0%*@%1= (% ,%>*)%', (0" 1".%<<"*,", -"12#%* %6 7;(0%*@ F" 0', ' )#(()" ,#66#.:)(; :2#*= (0" >#*,%>2 #*2('))"1B 2% >" %E(", 6%1 ' <'*:') #*2('))'(#%*@ G0"1" '1" 2("E 9; 2("E =:#,")#*"2 E1%-#,", %* (0" E;(0%* >"92#(" (% ="( ;%: :E '*, 1:**#*=H
!"()*+,- The key to getting communication established with the real world is installing a separate library called 7;I"1#') 6%1 (0" E;(0%* )'*=:'="@ J( #2 '* "A("1*') )#91'1; (0'( =#-"2 :2"12 ' (%%) C#( ,",#.'(", 6%1 2"1#') .%<<:*#.'(#%*@
8el[o 8aLllalnen Advanced MechaLronlcs 208 8afael erelra 1o geL Lhe llbrary navlgaLe Lo hLLp://pyserlal.sourceforge.neL Lo geL Lhe llbrary. 1here are some very helpful guldellnes on how Lo lncorporaLe Lhe llbrary on Lhe slLe. We had a few hlccups durlng Lhe process, so weve included our steps below: 1. Make sure Lhe recommended verslons of yLhon and 8lender are lnsLalled and worklng properly on your sysLem. 2. Download the Pyserial library (we chose the tar.gz for manual installation) and extract into your pyLhon dlrecLory (Lhe place where yLhon.exe llves). 3. Cnce Lhe llbrary ls copled lnLo Lhe pyLhon folder sysLem, Lhen we can manually lnsLall pyserlal. a. lrom Lhe command prompL navlgaLe Lo Lhe pyLhon home dlrecLory, Lhen lnLo Lhe extracted pyserial folder where you should find the setup.py file. b. lnsLall Lhe llbrary by enLerlng: "#$%&'&( )*"$+,, (for wlndows) l. lor Mac/llnux: "%-. &($/.* "#$%&'&( )*"$+,, 4. Cnce pyserlal ls successfully lnsLalled Lo pyLhon, we need Lo lncorporaLe lL lnLo Lhe blender pyLhon englne. navlgaLe Lo Lhe yserlal maln folder wlLhln Lhe pyLhon dlrecLory llsL and flnd the serial sub-folder. Copy the entire folder (were going to put the whole thing in Blenders englne) and pasLe lnLo your 8lender scrlpLs folder. a. Now locate your Blender Scripts folder by following the tutorial at hLLp://www.masLerprlm.com/blender-baslc-command/how-Lo-flnd-blender-scrlpLs- folder-wlndows-mac-llnux.php (Lhanks Lo Lhose folks, Lhey dld a greaL [ob) 3. now your serlal communlcaLlon should be good Lo go!! a. ?ou can verlfy lnsLallaLlon by enLerlng )0&.1$ "#1)+, lnLo Lhe scrlpLlng wlndow wlLhln Python. If no error pops up, then youve done an admirable job! If you do get an error, Lhen lL mlghL Lake a llLLle more work. 1ry golng back Lhrough Lhe sLeps or locaLlng a good frlend wlLh vasL knowledge of serlal communlcaLlon proLocols.
We developed some baslc sample code Lo geL you sLarLed wlLh Lhls very helpful llbrary. Agaln, we used Lhe Ardulno unC as our mlcroprocessor, buL any oLher processor wlLh serlal communlcaLlon should work [usL flne. 1he followlng examples are baslc, and are used Lo llghL Lhe bullL ln LLu on Lhe unC.
volJ loop() { lf ( 5etlol.ovolloble()) { cbot cb = 5etlol.teoJ(), lf(cb == '0') { Jlqltolwtlte(leJ, lOw), } lf(cb == '1') { Jlqltolwtlte(leJ, nlCn), } } } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In Blender, go to the text editor screen, type the following code, substituting the name of the serial port where the Arduino is connected. Substitute COM7 for whichever serial port ID on whichever system youre using. Substitute the write argument with 0 to turn the LED off.
import serial ser = serial.Serial(COM7, 9600) x=ser.write(1) print(x) ser.close()