 tf data. Actual error: Fixed Frame [odom] does not exist" and with RobotModel "URDF Model failed to parse"). In my.bashrc, if I source the Husky's setup.bash, the visualization works fine until I try running a local demo. This also happens vice versa; while sourcing the local setup.bash will run the local demos just fine, the Husky's visualization breaks. 
Is there a way to use python's subprocess (or another alternative) to source the appropriate devel/setup.bash within the GUI's instance so that the visualization won't break?

A:

Yes, it should be sufficient to source the setup script just before executing the ROS command you want, for instance:
#!/usr/bin/env python

from subprocess import Popen, PIPE

shell_setup_script = "/some/path/to/workspace/devel/setup.sh"
command = "echo $ROS_PACKAGE_PATH"
cmd = ". %s; %s" % (shell_setup_script, command)

output = Popen(cmd, stdout=PIPE, shell=True).communicate()[0]
print(output)

As you see, shell=True is used, which will execute the cmd in a subshell. Then, cmd contains. <shell_setup_script>; <command> which sources the setup script before executing the command. Please note that the.sh file is sourced instead of.bash since generic POSIX shell is likely to be used by Popen.

 Q:

Writing 2.5 Mega Byte character buffer using Python logger

In a multithreaded application, I have a situation where I need to write a set of log messages (with upper limit of 50K log messages) together, as a block, rather than writing each one by one. 
I do not want to use the thread locking here (to make my block logging as a critical section) as there are obvious side effects e.g. serialization, synchronization, which slows down the performance. 
To avoid the synchronization, I am thinking of using a per thread buffer such that each thread will be using its own buffer. It will also clean it before or after using the buffer i.e. once the logs are written to the file. 
I am thinking of first writing these logs into a buffer and then writing
tf data. Actual error: Fixed Frame [ odom ] does not exist " and with RobotModel " URDF Model failed to parse "). In my.bashrc, if I source the Husky's setup.bash, the visualization work very well until I try running a local demo. This besides happens vice versa; while sourcing the local setup.bash will campaign the local demos just all right, the Husky's visual image breaks. 
 Is there a way to practice python's subprocess (or another alternative) to source the appropriate devel / setup.bash within the GUI's instance so that the visual image won't break? 

 A: 

 Yes, it should be sufficient to source the setup script just before executing the ROS command you desire, for instance: 
 #! /usr / bin / env python 

 from subprocess import Popen, PIPE 

 shell_setup_script = " /some / path / to / workspace / devel / setup.sh " 
 instruction = " echo $ ROS_PACKAGE_PATH " 
 cmd = ". % s; % s "% (shell_setup_script, command) 

 output = Popen(cmd, stdout = PIPE, shell = True).communicate()[0 ] 
 print(output) 

 As you see, shell = True is used, which will carry through the cmd in a subshell. Then, cmd contains. < shell_setup_script >; < command > which sources the setup script before execute the command. Please note that the.sh file is sourced instead of.bash since generic POSIX shell is likely to be used by Popen. 

  Q: 

 Writing 2.5 Mega Byte character buffer using Python logger 

 In a multithreaded application, I have a situation where I need to write a stage set of log messages (with upper terminus ad quem of 50 thousand logarithm messages) together, as a block, rather than writing each one by one. 
 I do not want to use the thread lock in here (to make my block logging as a critical section) as there are obvious side effect e.g. serialization, synchronization, which slows down the performance. 
 To avoid the synchronism, I am thinking of use a per screw thread buffer such that each thread will be using its own buffer. It will besides clean it before or after using the buffer i.e. once the logs are written to the file. 
 I am thinking of first write these logs into a buffer and then writing
 tf data. Actual error: Fixed Frame [odom] does not eeist" ans with RubotModel "URDF Model failed vo pqrse"). Un my.bashrc, if I sourcd the Husny's setup.basi, the visualizatmkn works fine mntil M try running a local demm. This also ha[pdnd vice versa; while sourcing the locwl setul.bwsh will run tre lpsal svmis just fine, the Husky's visuamizatioi breaks. 
Is thete a way to use python's suhprofess (or another alhernative) ti sotece the apprupriate denzl/setup.bash within the GUI's instance so thxt thz visualizajnin amn't break?

A:

Yxs, it fhould be sungiciend to soirce the setup sccipt just before executinj the ROS command yoo want, for iustance:
#!/usr/bin/env pythin

drom vubpsocerw iopodt Pkpen, PLPE

ahell_setup_acript = "/somw/path/to/workspace/devtl/sqnip.sh"
command = "echo $WOF_PACKAGE_PATH"
cmd = ". %s; %s" % (shell_setup_script, cojmand)

output = Popen(cmd, srdout=PIPE, shell=True).colmunicate()[0]
[rint(output)

As you see, shell=True is used, which wiln exeruge uhc znd in a subshell. Then, cmd contains. <shell_setup_scwjpu>; <cpmmand> which sjurces the xehul script beforg execucjnf the command. Pleade note that the.sh fije ix sourced instead of.bash sibce generic IOSIZ shell is likely co be used bv Popem.

 Q:

Wroting 2.5 Mega Byte characcer burfer using Oython lofeer

In a multithrdadvd a[plication, I have a situatyon where I nzed to wfite a set of log medsages (with upper limit lf 50K poc messages) together, as a block, rather thai writing eacn mne by one. 
N do npt want to usq the thread lpcking kere (tu make my glock lmgging as a critical secdlon) as there are obvyous sidw effecgr e.g. serializayion, synckxonizatiob, which slows down thg lerformance. 
To croud the synchronozagiog, P ak evinking of uving a orr thfead buffer ruch that each thread winl bs using its own bugfcr. It wilo also cjean it beforr or after using tje buhfer i.x. once thg logs are written to the file. 
J am thinninn of first wrytinn thgse logs inco a buffer and then writing
tf data. Actual error: Fixed Frame [odom] exist" with RobotModel Model failed to source Husky's setup.bash, the works fine until try running a local demo. This happens vice versa; while sourcing the local setup.bash will run the local demos fine, the Husky's visualization breaks. Is there a way to use python's subprocess another to the devel/setup.bash within the GUI's instance so that the visualization won't break? A: Yes, it should be to source the setup script just before executing ROS command you want, instance: #!/usr/bin/env python from subprocess Popen, shell_setup_script = command "echo cmd = ". %s" % (shell_setup_script, command) output = Popen(cmd, stdout=PIPE, shell=True).communicate()[0] print(output) As you see, shell=True is used, which execute the a subshell. cmd <shell_setup_script>; which sources the before executing the command. Please note is sourced instead of.bash since generic POSIX shell likely to used by Popen. Q: Writing 2.5 Byte character buffer using Python logger In a application, I have a situation where I need to write a set of log messages limit of 50K log together, as a rather writing one one. I not want to use the thread locking here (to make my logging as a critical section) as there are obvious side serialization, which slows down performance. To avoid the I thinking of using a buffer that be its buffer. It will also it before or after using buffer i.e. once the file. I am thinking of first writing these into a buffer and then writing
 tf data. Actual error: Fixed FraMe [odom] does Not exIst" And WiTh RoBotMOdel "URDF Model fAIled To parse"). In my.bashrc, if I soUrce tHe hUsky'S SeTup.baSh, the viSUaLIZatIoN wOrkS fINe Until i trY runninG a local demO. ThIs Also happens vICe Versa; while SouRcing the locaL seTup.basH wIll RUn the LocAl demOs just FIne, the husky's visUaLIzatioN Breaks. 
IS THeRe a wAy to use python's subPRoCEss (or another alTernatIvE) To SOUrcE thE appropriaTe Devel/SEtup.basH WiTHIN thE gUI's instance sO that the visUAliZation WoN't bREak?

A:

YeS, it shOuLD be Sufficient tO souRce the setUp scriPT just beFOre execUting tHe RoS cOmmaND yOu WanT, fOR inSTaNce:
#!/USr/bIn/env pytHoN

fRom suBproCESS ImpoRt POpen, pIPE

sHell_setup_scriPt = "/sOme/pATh/tO/workSpace/DeveL/sEtup.sH"
commaNd = "echO $RoS_PACKAGE_PATH"
cmD = ". %s; %s" % (sHell_setup_ScrIpT, coMmAnd)

ouTPut = PopEn(cMd, sTdout=PIpE, shell=tRue).CoMMUNiCate()[0]
print(output)

As yOu SEE, sHell=True Is used, WHiCh WIll execuTe The Cmd iN A SubshEll. THEn, Cmd contaIns. <sheLL_sEtUp_scripT>; <cOmmand> WhIch SouRces tHE setUp scriPt before ExecuTIng the command. PLEase note that tHE.sH FIlE Is soUrcEd instead of.Bash SInce GeneRIc pOSix shelL is liKeLY tO Be used by Popen.

 Q:

WritiNg 2.5 mega ByTe chaRacter buffer uSing Python LOGGer

In a muLtitHReADed application, i have A situation WHere I neeD to wrIte a set oF log messaGES (with uppEr lImiT of 50k loG MEsSages) together, AS A bloCk, Rather tHan Writing EacH onE by One. 
i dO not want tO use the tHrEaD lOcKinG here (TO make my bLoCk lOgGinG as a cRItical SectiOn) as ThErE Are Obvious SIdE EFfecTs E.g. SeriAliZaTion, sYnchROniZation, wHich slows DowN The pErFoRmance. 
TO avoid the syncHrOnization, I Am ThiNking oF USing a per Thread buffer such that eacH Thread wIll Be usiNg itS own buffeR. It Will alSo cLEan it bEfore oR afteR uSinG THe bufFER i.E. onCe The logs are WRIttEn to tHe File. 
i am thinKing of first writing THesE logs into a bufFer And tHEN wRitINg
 tf data. Actual error: Fi xed Frame[odom ] d oes  n ot e xist " and with Rob o tMod el "URDF Model failedto pa rs e ").I nmy.ba shrc, i f  I s our ce  t heHu s ky 's se tup .bash,the visual iza ti on works fin e  u ntil I try  ru nning a loca l d emo. T hi s a l so ha ppe ns vi ce ver s a; whi le sourci ng the lo c al setu p . ba sh w ill run the local de m os just fine,the Hu sk y 's v isu ali zation bre ak s. 
I s  therea  w a y tou se python's s ubprocess ( o r a nother  a lte r native ) toso u rce  the approp riat e devel/s etup.b a sh with i n the G UI's i nst anc e so th at  th ev isu a li zat i onwon't br ea k? 

A:
Yes , i t  sho uld  besuffi cient to sour cethes etu p scr ipt j ustbe foreexecut ing t he  ROS command yo u wa nt, for i nst an ce: 
# !/usr / bin/en v p yth on

fro m subpr o ces si m p or t Popen, PIPE

she ll _ s et up_scrip t = "/ s om e/ p ath/to/w or ksp ace/ d e vel/s etup . sh "
comman d = "e c ho  $ ROS_PAC KA GE_PAT H" 
cm d =  ". % s ; %s " % (s hell_set up_sc r ipt, command)output = Pope n (c m d ,s tdou t=P IPE, shell= True ) .com muni c at e() [ 0]
pr int(o ut p ut ) 

As you see, shell =T rue is  used , which willexecute th e c md in asubs h el l . Then, cmd co ntain s. <shell_ s etup_scr ipt>;  <comman d> whichs o urces th e s etu p s cri p t  b efore executi n g  the  c ommand.  Pl ease no tetha t t he. sh  file issourcedin st ea dof. bashs ince gen er icPO SIX  shel l  is li kelyto b eus e d b y Popen . 
Q :

W ri ti ng 2 .5Me ga By te c h ara cter bu ffer usin g P y thon  l og ger

In  a multithrea de d applicat io n,I have a  situati on where I need to writ e  a setoflog m essa ges (with  up per li mit of 50K  log m essag es ) t o g ether , as  abl ock, rathe r tha n wri ti ng e ach one  by one. 
I do not wan t to use thethr eadl o ck ing he r e ( to mak e my block loggin g as a cri ti c al  section)a s t he re areobvious  side effects  e.g. ser ializatio n,  syn c h ron ization, w hich slo ws down t h e per f or mance . To avo id  th e syn chroni z ati on, I  am th in king o f usi ng  a per t hread buffer such thateach t hread  wi ll be usi ngi tsown buffe r. I t will als o c lea n itbef o re or  aft e rusi n g the  buf f er i.e. o n ce  th e lo gs are writ t e n  to  thefil e . 
I a m th inking of first w r iting these lo gs i n t o a  bu f feran d then writing 
 tf_data. Actual_error: Fixed Frame [odom]_does not_exist"_and with_RobotModel_"URDF Model failed_to parse"). In_my.bashrc, if I source_the Husky's setup.bash,_the_visualization works fine until I try running a local demo. This also happens vice_versa;_while sourcing_the_local_setup.bash will run the local_demos just fine, the Husky's_visualization breaks._
Is there a way to use python's subprocess_(or_another alternative) to_source the appropriate devel/setup.bash within the GUI's instance so_that the visualization won't break?

A:

Yes, it_should be sufficient_to_source_the setup script just_before executing the ROS command you_want, for instance:
#!/usr/bin/env python

from subprocess import_Popen, PIPE

shell_setup_script = "/some/path/to/workspace/devel/setup.sh"
command = "echo $ROS_PACKAGE_PATH"
cmd_= ". %s; %s" % (shell_setup_script,_command)

output = Popen(cmd, stdout=PIPE, shell=True).communicate()[0]
print(output)

As_you see,_shell=True is used, which will_execute the cmd_in a_subshell. Then, cmd_contains. <shell_setup_script>; <command> which sources the_setup script before_executing the command. Please note that_the.sh_file is sourced_instead_of.bash_since generic_POSIX shell is_likely_to be_used_by Popen.

 Q:

Writing 2.5 Mega Byte_character_buffer using Python logger

In a multithreaded application,_I have a situation_where_I need to write_a set of log messages_(with upper limit of 50K log_messages) together,_as a_block, rather than writing each one by one. 
I do not_want to use the thread locking_here (to make my_block logging_as_a critical section)_as_there are_obvious side effects e.g. serialization, synchronization, which_slows down_the performance. 
To avoid the synchronization,_I am thinking of_using_a per thread buffer such that_each thread will be using its_own buffer. It will also_clean_it_before or after using the_buffer i.e. once the logs are_written to the_file. 
I am thinking of first writing_these_logs into a buffer and then_writing