tmp<Field<Type2> >
ProcessorPointPatchField
<PatchField, Mesh, PointPatch, ProcessorPointPatch, MatrixType, Type>::
receiveEdgeField
(
    const Pstream::commsTypes commsType
) const
{
    tmp<Field<Type2> > tf
    (
        new Field<Type2>(procPatch_.localEdgeIndices().size())
    );

    IPstream::read
    (
        commsType,
        procPatch_.neighbProcNo(),
        reinterpret_cast<char*>(tf().begin()),
        tf().byteSize()
    );

    return tf;
}
Beispiel #2
0
void DebuggerTree::OnSaveWatchFile(wxCommandEvent& event)
{
    // Verify that there ARE watches to save
    size_t wc = m_Watches.GetCount();
    if (wc<1)
    {
        cbMessageBox(_("There are no watches in the list to save."),
                     _("Save Watches"), wxICON_ERROR);
        return;
    }

    wxString fname;
    wxFileDialog dlg (Manager::Get()->GetAppWindow(),
                    _T("Save debugger watch file"),
                    _T(""),
                    _T(""),
                    _T("Watch files (*.watch)|*.watch|Any file (*)|*"),
                    wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
    PlaceWindow(&dlg);
    if (dlg.ShowModal() != wxID_OK)
        return;

    wxTextFile tf(dlg.GetPath());
    bool bSuccess = false;

    // Create() will fail if the file exist -> must use Open() if file exist
    if (tf.Exists())
    {
        bSuccess = tf.Open();
        if (bSuccess) tf.Clear(); // remove old content (if any)
    }
    else
    {
        bSuccess = tf.Create();
    }

    if (bSuccess)
    {
        // iterate over each watch and write them to the file buffer
        for (size_t i = 0; i < wc; ++i)
        {
            Watch& w = m_Watches[i];
            tf.AddLine(w.keyword);
        }
        tf.Write(); // Write buffer to file
        tf.Close(); // release file handle
    }
    else
        Manager::Get()->GetLogManager()->DebugLog(_T("Error opening debugger watch file: ") + fname);
}
Beispiel #3
0
int doIt() 
{
  // create a tree

  boost::shared_ptr<AIDA::IAnalysisFactory> af( AIDA_createAnalysisFactory() );
  boost::shared_ptr<AIDA::ITreeFactory> tf( af->createTreeFactory() ); 
  bool readOnly = true;
  bool createNew = false;
  boost::shared_ptr<AIDA::ITree> tree(tf->create("exatup.aida", "xml", readOnly, createNew)); 

  //  boost::shared_ptr<AIDA::ITupleFactory> tupF ( af->createTupleFactory(*tree) ) ;

  AIDA::ITuple * tuple = dynamic_cast<AIDA::ITuple*> ( tree->find("100") );
  if ( !tuple ) {
    std::cerr << "ERROR reading tuple !!" << std::endl;
    return 1;
  }

  const int ia = tuple->findColumn( "px" );
  const int ib = tuple->findColumn( "py" );
  const int ic = tuple->findColumn( "pz" );
  const int id = tuple->findColumn( "mass" );

  std::cout << "Checking the tuple..." << std::endl;

  tuple->start();
  int i = 0;
  double va, vb, vc, vd;
  while ( tuple->next() ) {
    if (++i < 10) {
      va = tuple->getFloat(ia);
      vb = tuple->getFloat(ib);
      vc = tuple->getFloat(ic);
      vd = tuple->getFloat(id);
      std::cerr << "Found col " << tuple->columnName( ia ) << ": " << va << std::endl;
      std::cerr << "Found col " << tuple->columnName( ib ) << ": " << vb << std::endl;
      std::cerr << "Found col " << tuple->columnName( ic ) << ": " << vc << std::endl;
      std::cerr << "Found col " << tuple->columnName( id ) << ": " << vd << std::endl;
    }
    

  }

  std::cout << "Rows found : " << i << std::endl;

  tree->commit();
  tree->close();
  
  return 0;
}
bool BatchCommands::WriteChain(const wxString & chain)
{
   // Build the filename
   wxFileName name(FileNames::ChainDir(), chain, wxT("txt"));

   // Set the file name
   wxTextFile tf(name.GetFullPath());

   // Create the file (Create() doesn't leave the file open)
   if (!tf.Exists()) {
      tf.Create();
   }

   // Open it
   tf.Open();

   if (!tf.IsOpened()) {
      // wxTextFile will display any errors
      return false;
   }

   // Start with a clean slate
   tf.Clear();

   // Copy over the commands
   int lines = mCommandChain.GetCount();
   for (int i = 0; i < lines; i++) {
      // restore deprecated commands in chain script
      if (mCommandChain[i] == wxT("ExportMP3_56k_before"))
         mCommandChain[i] = wxT("SaveMP3_56k_before");
      else if (mCommandChain[i] == wxT("ExportMP3_56k_after"))
         mCommandChain[i] = wxT("SaveMP3_56k_after");
      else if (mCommandChain[i] == wxT("ExportFLAC"))
         mCommandChain[i] = wxT("ExportFlac");
      else if (mCommandChain[i] == wxT("ExportMP3"))
         mCommandChain[i] = wxT("ExportMp3");
      else if (mCommandChain[i] == wxT("ExportWAV"))
         mCommandChain[i] = wxT("ExportWav");

      tf.AddLine(mCommandChain[i] + wxT(":") + mParamsChain[ i ]);
   }

   // Write the chain
   tf.Write();

   // Done with the file
   tf.Close();

   return true;
}
Beispiel #5
0
void write_profile()
{
  Int_t ch = 0;
  TString fname("d4r_profile_");
  fname += ch;
  fname += ".root";
  TFile tf(fname,"RECREATE");
  
  d4r->GetProfile(0)->GetXaxis()->UnZoom();
  d4r->GetProfile(0)->GetYaxis()->UnZoom();
  d4r->GetProfile(0)->Write();
  tf.Close();
  cout<<"fprofile[0] is written to "<<fname<<endl;
}
TEST_F(LoadPlanningModelsPr2, InitOK)
{
  ASSERT_TRUE(urdf_ok_);
  ASSERT_EQ(urdf_model_->getName(), "pr2_test");

  robot_model::RobotModelPtr kmodel(new robot_model::RobotModel(urdf_model_, srdf_model_));
  robot_state::RobotState ks(kmodel);
  ks.setToRandomValues();
  ks.setToDefaultValues();


  robot_state::Transforms tf(kmodel->getModelFrame());

  Eigen::Affine3d t1;
  t1.setIdentity();
  t1.translation() = Eigen::Vector3d(10.0, 1.0, 0.0);
  tf.setTransform(t1, "some_frame_1");

  Eigen::Affine3d t2(Eigen::Translation3d(10.0, 1.0, 0.0)*Eigen::AngleAxisd(0.5, Eigen::Vector3d::UnitY()));
  tf.setTransform(t2, "some_frame_2");

  Eigen::Affine3d t3;
  t3.setIdentity();
  t3.translation() = Eigen::Vector3d(0.0, 1.0, -1.0);
  tf.setTransform(t3, "some_frame_3");


  EXPECT_TRUE(tf.isFixedFrame("some_frame_1"));
  EXPECT_FALSE(tf.isFixedFrame("base_footprint"));
  EXPECT_TRUE(tf.isFixedFrame(kmodel->getModelFrame()));

  Eigen::Affine3d x;
  x.setIdentity();
  tf.transformPose(ks, "some_frame_2", x, x);
  
  EXPECT_TRUE(t2.translation() == x.translation());
  EXPECT_TRUE(t2.rotation() == x.rotation());

  tf.transformPose(ks, kmodel->getModelFrame(), x, x);
  EXPECT_TRUE(t2.translation() == x.translation());
  EXPECT_TRUE(t2.rotation() == x.rotation());

  x.setIdentity();
  tf.transformPose(ks, "r_wrist_roll_link", x, x);

  EXPECT_NEAR(x.translation().x(), 0.585315, 1e-4);
  EXPECT_NEAR(x.translation().y(), -0.188, 1e-4);
  EXPECT_NEAR(x.translation().z(), 1.24001, 1e-4);
}
Beispiel #7
0
bool QJDSegyBH::writeData(const QString& fn,QJDDataStream::ByteOrder bo,QJDDataStream::DataFormat df)
{
    QFile tf(fn);
    if (!tf.open(QIODevice::ReadWrite))
        return false;
    QJDDataStream ds(&tf);
    ds.setByteOrder(bo);
    ds.setFormat(df);
    tf.seek(3200);
    ds<<*this;
    //ds.unsetDevice();
    ds.setDevice(0);
    tf.close();
    return true;
}
Beispiel #8
0
void Util::EventLog(CString strError)
{
	CString strPath;
	strPath=GetRootPath();
	strPath+="/temp/msevent.log";


	ThreadFile tf(strPath);

	strError+="\r\n";

	CTime stime=CTime::GetCurrentTimeEx();

	CString strlog;
	strlog.Format("%s\t%s",stime.Format().c_str(),strError.getText());

	char *pstr=strlog.getText();

	tf.append(pstr,(ccxx_size_t)strlen(pstr));
	

	

/*
	CString strTemp=_T(""),
		strFile=_T("");
	strFile.Format("%s\\MonitorManager\\meevent.log",g_strRootPath);

	CTime time=CTime::GetCurrentTime();
	strTemp=time.Format("%Y-%m-%d %H:%M:%S");

	strTemp+="\t"+strError+"\r\n";
#ifndef DEBUG_T	
	FILE *fp=::fopen(strFile,"a+");
	if(fp==NULL)
	{
		printf("���ʧ�\n");
		return ;
	}
	::fputs(strTemp,fp);
	::fclose(fp);
#else
	printf("%s",strTemp);
#endif
	*/
	return ;

}
Beispiel #9
0
int main(int argc, char* argv[])
{
  Getopt getopt;
  getopt.addOption("help", Option::NO_ARG);
  getopt.addOption("verbose", Option::NO_ARG);
  if (getopt.processOpts(argc, argv)) {
    showHelp(argv[0]);
    return 1;
  }
  if (argc - getopt.first_non_opt() != 2) {
    showHelp(argv[0]);
    return 1;
  }
  if (getopt.getOption('h').is_set()) {
    showHelp(argv[0]);
    return 0;
  }
  const bool verbose = getopt.getOption('v').is_set();

  const size_t N = atoi(argv[getopt.first_non_opt()]);
  const size_t b = atoi(argv[1 + getopt.first_non_opt()]);

  TupleFactory<size_t> tf(b);
  const std::pair<size_t, size_t> ret = generate_tuples_mod_N(tf, N);

  if (verbose) {
    std::cout << "N=" << N << " b=" << b << "\n"
	      << "first=" << ret.first << " last=" << ret.second << std::endl;
  }

  for (size_t ii = ret.first; ii <= ret.second; ++ii) {
    const TupleFactory<size_t>::tuple_type tuple = tf.make_copy(ii);
    assert(tuple.size() == tf.size());
    std::cout << tuple << std::endl;
  }
  const size_t x = tf.create_and_store_tuple();
  const size_t y = ret.first;
  const TupleFactory<size_t>::tuple_type tuple_x = tf.make_copy(x);
  const TupleFactory<size_t>::tuple_type tuple_y = tf.make_copy(y);
  assert(tuple_x.size() == tf.size());
  assert(tuple_y.size() == tf.size());
  if (verbose) {
    std::cout << tuple_x << ' '
	      << tuple_y << ' '
	      << std::boolalpha << tf.isequal(x, y)
	      << std::endl;
  }
}
Beispiel #10
0
void SolveB5C(HDesign& hd)
{
  double sizes1[] = {1,2,4};
  double sizes2[] = {1,2,4,8,16,32};

  int len1 = sizeof(sizes1)/sizeof(sizes1[0]);
  int len2 = sizeof(sizes2)/sizeof(sizes2[0]);

  TableFormatter tf("B5C solutions", 6);
  for(int c = 1; c < 6; ++c)
    tf.SetColumnPrecision(c, 1);
  tf.SetColumnPrecision(0, 4);
  tf.NewHeaderRow();
  tf.SetCell(0, "TNS");
  tf.SetCell(1, "x1");
  tf.SetCell(2, "x2");
  tf.SetCell(3, "x3");
  tf.SetCell(4, "x4");
  tf.SetCell(5, "x5");
  tf.FlushLastRow();

  double x1=1,x2=1,x3=1,x4=1,x5=1;
  double btns = B5CTiming(hd, x1, x2, x3, x4, x5, false) + 1.0;

  for (int i1 = 0; i1 < len2; ++i1)
    for (int i2 = 0; i2 < len1; ++i2)
      for (int i3 = 0; i3 < len2; ++i3)
        for (int i4 = 0; i4 < len1; ++i4)
          for (int i5 = 0; i5 < len1; ++i5)
          {
            double tns = B5CTiming(hd, sizes2[i1], sizes1[i2], sizes2[i3], sizes1[i4], sizes1[i5], false);
            if (tns < btns)
            {
              btns = tns;
              tf.NewRow();
              tf.SetCell(0, tns);
              tf.SetCell(1, x1 = sizes2[i1]);
              tf.SetCell(2, x2 = sizes1[i2]);
              tf.SetCell(3, x3 = sizes2[i3]);
              tf.SetCell(4, x4 = sizes1[i4]);
              tf.SetCell(5, x5 = sizes1[i5]);
              tf.FlushLastRow();
            }
          }

  tf.Print(0, false);
  B5CTiming(hd, x1, x2, x3, x4, x5);
}
Beispiel #11
0
bool QJDSegyBH::readData(const QString& fn,QJDDataStream::ByteOrder bo,QJDDataStream::DataFormat df)
{
    QFile tf(fn);
    if (!tf.open(QIODevice::ReadOnly))
        return false;
    QJDDataStream ds(&tf);
    ds.setByteOrder(bo);        // 设置Little Endian或BigEndian
    ds.setFormat(df);           // 设置IBM 或 IEEE
    tf.seek(3200);
    ds>>*this;                  //如果格式是IBM,则全部转换为IEEE。如果不是IBM,则直接输入
    //ds.unsetDevice();           //已经被淘汰,使用setDevice(0)来代替
    ds.setDevice(0);
    tf.close();

    return true;
}
TEST(Automata, TransitionFunction_AddTransition_CorrectState){
    unsigned int stateCount = 3;
    unsigned int symbolCount = 2;

    int fromState = 0;
    int symbol = 0;
    int expectedToState = 1;

    TransitionFunction tf(stateCount, symbolCount);

    tf.addTransition(fromState, symbol, expectedToState);

    int actualToState = tf.getState(fromState, symbol);

    EXPECT_EQ(expectedToState, actualToState);
}
Beispiel #13
0
TEST_F(TestFuture, ComplexType) {
  TestFutureS tf(gGlobalS, gGlobalE);

  qi::Promise<std::string> pro;

  qi::Future<std::string>  fut = pro.future();

  fut.connect(boost::bind(&TestFutureS::onFutureFinished, tf, _1));

  EXPECT_STREQ("", gGlobalS.c_str());
  EXPECT_FALSE(fut.isReady());
  pro.setValue("42");
  EXPECT_TRUE(fut.isReady());
  EXPECT_STREQ("42", fut.value().c_str());
  EXPECT_STREQ("42", gGlobalS.c_str());
}
Beispiel #14
0
bool MachCallNode::return_value_is_used() const {
  if (tf()->range()->cnt() == TypeFunc::Parms) {
    // void return
    return false;
  }

  // find the projection corresponding to the return value
  for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
    Node *use = fast_out(i);
    if (!use->is_Proj()) continue;
    if (use->as_Proj()->_con == TypeFunc::Parms) {
      return true;
    }
  }
  return false;
}
Beispiel #15
0
TEST_F(TestFuture, TestError) {
  TestFutureI tf(gGlobalI, gGlobalE);

  qi::Promise<int> pro;

  qi::Future<int>  fut = pro.future();
  fut.connect(boost::bind(&TestFutureI::onFutureFinished, tf, _1));

  EXPECT_STREQ("", gGlobalE.c_str());
  EXPECT_FALSE(fut.isReady());
  pro.setError("chiche");
  fut.wait();
  EXPECT_STREQ("chiche", gGlobalE.c_str());
  EXPECT_TRUE(fut.isReady());
  EXPECT_TRUE(fut.hasError());
}
void PlacementQualityAnalyzer::Report(const string& caption)
{
    TableFormatter tf(caption);
    ReorderColumns();

    tf.NewHeaderRow();
    tf.SetCell(0, "ID");

    for (int i = 0; i < __MetricsNum; i++)
    {
        tf.SetCell(metricsInfo[i].column, metricsInfo[i].Name.c_str());
        tf.SetColumnPrecision(metricsInfo[i].column, metricsInfo[i].precision);
    }

    tf.NewBorderRow();
    tf.SetCell(0, "-", tf.NumOfColumns(), TableFormatter::Align_Fill);

    for(QualityList::iterator i = m_experiments.begin(); i != m_experiments.end(); ++i)
    {
        tf.NewRow();
        tf.SetCell(0, i->id);

        for (int idx = 0; idx < __MetricsNum; idx++)
            tf.SetCell(metricsInfo[idx].column, i->metrics[idx]);
    }

    if (m_design.cfg.ValueOf(".PQAT.showPercents", false))
    {
        tf.NewBorderRow();
        tf.SetCell(0, "-", tf.NumOfColumns(), TableFormatter::Align_Fill);

        QualityList::iterator initial = m_experiments.begin();
        for(QualityList::iterator i = m_experiments.begin(); i != m_experiments.end(); ++i)
        {
            tf.NewRow();
            tf.SetCell(0, i->id);

            for (int idx = 0; idx < __MetricsNum; idx++)
                tf.SetCell(metricsInfo[idx].column, i->metrics[idx] / initial->metrics[idx] * 100);
        }
    }

    WRITELINE("");
    tf.Print();
    WRITELINE("");
}
Beispiel #17
0
void Tags::LoadGenres()
{
   wxFileName fn(FileNames::DataDir(), wxT("genres.txt"));
   wxTextFile tf(fn.GetFullPath());

   if (!tf.Exists() || !tf.Open()) {
      LoadDefaultGenres();
      return;
   }

   mGenres.clear();

   int cnt = tf.GetLineCount();
   for (int i = 0; i < cnt; i++) {
      mGenres.push_back(tf.GetLine(i));
   }
}
Beispiel #18
0
TEST(Bullet, TransformOrder )
{
  btTransform tf(btQuaternion(1,0,0));
  btTransform tf2(btQuaternion(0,0,0),btVector3(100,0,0));

  btTransform tf3 = tf * tf2;

  tf*= tf2;
  EXPECT_TRUE(tf3  == tf);

  tf = btTransform(btQuaternion(1,0,0));
  tf3 = tf;

  EXPECT_TRUE(tf.inverse() * tf2 == tf.inverseTimes(tf2));

  
}
Beispiel #19
0
wxString
Md5OfFile(const wxString &name)
{
    wxLogNull dummy;
    wxTextFile tf(name);
    md5_state_t state;
    md5_byte_t digest[16];

    md5_init(&state);
    if (tf.Exists() && tf.Open()) {
        wxString line;
        for (line = tf.GetFirstLine(); !tf.Eof(); line = tf.GetNextLine()) {
            const wxWX2MBbuf buf = wxConvCurrent->cWX2MB(line);
            const char *cc = wx_static_cast(const char*, buf);
            md5_append(&state, wx_reinterpret_cast(const md5_byte_t *, cc), line.Length());
        }
    }
Beispiel #20
0
//------------------------------Registers--------------------------------------
const RegMask &MachCallJavaNode::in_RegMask(uint idx) const {
  // Values in the domain use the users calling convention, embodied in the
  // _in_rms array of RegMasks.
  if (idx < tf()->domain()->cnt()) {
    return _in_rms[idx];
  }
  if (idx == mach_constant_base_node_input()) {
    return MachConstantBaseNode::static_out_RegMask();
  }
  // Values outside the domain represent debug info
  Matcher* m = Compile::current()->matcher();
  // If this call is a MethodHandle invoke we have to use a different
  // debugmask which does not include the register we use to save the
  // SP over MH invokes.
  RegMask** debugmask = _method_handle_invoke ? m->idealreg2mhdebugmask : m->idealreg2debugmask;
  return *debugmask[in(idx)->ideal_reg()];
}
Beispiel #21
0
TEST_F(TestFuture, SimpleType) {
  TestFutureI tf(gGlobalI, gGlobalE);

  qi::Promise<int> pro;

  qi::Future<int>  fut = pro.future();

  fut.connect(boost::bind(&TestFutureI::onFutureFinished, tf, _1));

  EXPECT_EQ(0, gGlobalI);
  EXPECT_FALSE(fut.isReady());
  pro.setValue(42);
  fut.wait(1000);
  EXPECT_TRUE(fut.isReady());
  EXPECT_EQ(42, fut.value());
  EXPECT_EQ(42, gGlobalI);
}
Beispiel #22
0
static
void RunBasicTest()
{
    int value;
    SDL_SpinLock lock = 0;

    SDL_atomic_t v;
    SDL_bool tfret = SDL_FALSE;

    printf("\nspin lock---------------------------------------\n\n");

    SDL_AtomicLock(&lock);
    printf("AtomicLock                   lock=%d\n", lock);
    SDL_AtomicUnlock(&lock);
    printf("AtomicUnlock                 lock=%d\n", lock);

    printf("\natomic -----------------------------------------\n\n");
     
    SDL_AtomicSet(&v, 0);
    tfret = SDL_AtomicSet(&v, 10) == 0;
    printf("AtomicSet(10)        tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
    tfret = SDL_AtomicAdd(&v, 10) == 10;
    printf("AtomicAdd(10)        tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));

    SDL_AtomicSet(&v, 0);
    SDL_AtomicIncRef(&v);
    tfret = (SDL_AtomicGet(&v) == 1);
    printf("AtomicIncRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
    SDL_AtomicIncRef(&v);
    tfret = (SDL_AtomicGet(&v) == 2);
    printf("AtomicIncRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
    tfret = (SDL_AtomicDecRef(&v) == SDL_FALSE);
    printf("AtomicDecRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
    tfret = (SDL_AtomicDecRef(&v) == SDL_TRUE);
    printf("AtomicDecRef()       tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));

    SDL_AtomicSet(&v, 10);
    tfret = (SDL_AtomicCAS(&v, 0, 20) == SDL_FALSE);
    printf("AtomicCAS()          tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
    value = SDL_AtomicGet(&v);
    tfret = (SDL_AtomicCAS(&v, value, 20) == SDL_TRUE);
    printf("AtomicCAS()          tfret=%s val=%d\n", tf(tfret), SDL_AtomicGet(&v));
}
movebase_node.cpp
//
/*
 * Copyright (c) 2013, Willow Garage, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the Willow Garage, Inc. nor the names of its
 *       contributors may be used to endorse or promote products derived from
 *       this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

//#include <move_base/move_base.h>
#include "../include/move_base/move_base.h"

int main(int argc, char** argv){
  ros::init(argc, argv, "move_base_node");
  tf::TransformListener tf(ros::Duration(10));

  move_base::MoveBase move_base( tf );

  //ros::MultiThreadedSpinner s;
  ros::spin();

  return(0);
}
Beispiel #24
0
void DebuggerTree::OnLoadWatchFile(wxCommandEvent& event)
{
    WatchesArray fromFile = m_Watches; // copy current watches

    // ToDo:
    // - Currently each watch is imported as WatchType "Unspecified". This should
    //   be changed that the file contains another (optional) column with the type.
    // - Change "Watch files" format to XML?
    // - With the current implementation sometimes the debugger tree gets weird.
    // - (Maybe) verify that watches are not already present?

    wxString fname;
    wxFileDialog dlg (Manager::Get()->GetAppWindow(),
                    _T("Load debugger watch file"),
                    _T(""),
                    _T(""),
                    _T("Watch files (*.watch)|*.watch|Any file (*)|*"),
                    wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR | compatibility::wxHideReadonly);
    PlaceWindow(&dlg);
    if (dlg.ShowModal() != wxID_OK)
        return;

    wxTextFile tf(dlg.GetPath());
    if (tf.Open())
    {
        // iterate over each line of file and send to debugger
        wxString cmd = tf.GetFirstLine();
        while(true)
        {
            if (!cmd.IsEmpty()) // Skip empty lines
            {
//                Manager::Get()->GetLogManager()->DebugLog(_T("Adding watch \"%s\" to debugger:"), keyword);
                AddWatch(cmd, Undefined, false); // do not notify about new watch (we 'll do it when done)
            }
            if (tf.Eof()) break;
                cmd = tf.GetNextLine();
        }
        tf.Close(); // release file handle

        // notify about changed watches
        NotifyForChangedWatches();
    }
    else
        Manager::Get()->GetLogManager()->DebugLog(_T("Error opening debugger watch file: ") + fname);
}
int main(void)
{
    srand(time(NULL));
    example_usage::TextureFactory tf(256);

    int count = 0;

    example_usage::Texture *t;

    while ((t = tf.create(count++))) {
        int *tempTexture = randomTexture();
        t->loadTexture(tempTexture);
        free(tempTexture);
        std::cout << "\n\n" << *t;
    }

    t = tf.create(count++); /* this should fail */

    if (!t) {
        std::cout << "\npoolSize+1 allocation failed. (YAY!)";
    } else {
        std::cout << "\nAllocation succeedded (BOO-URNS).";
    }

    std::cout << "\n";
    std::cout << tf;

    tf.mark(1000);
    tf.free(2000);

    std::cout << "\n";
    std::cout << tf;

    t = tf.create(count++);

    if (!t) {
        std::cout << "\nAfter empty allocation failed. (BOO-URNS!)";
    } else {
        std::cout << "\nAfter empty allocation succeedded (YAY!).";
    }

    std::cout << "\n";
    std::cout << tf;

}
int main(int argc, char** argv)
{

    ros::init(argc, argv, "cb_local_planner_interface");

    // Transform listener
    tf::TransformListener tf(ros::Duration(10));

    // Setup the global costmap
    costmap_2d::Costmap2DROS costmap("local_costmap", tf);

    // Create the base controller interface
    cb_local_planner::LocalPlannerInterface lpi(&costmap);

    ros::spin();

    return 0;
}
void timeout_filter::on_timer( void ){
	if ( _closed )
		return;

	if ( ( tcode::time_stamp::now() - _stamp ) > _timeout ){
		close( tcode::diagnostics::timeout );
		return;
	}

	tcode::rc_ptr< timeout_filter > tf( this );
	auto et = tcode::transport::event_timer::create_timer( channel()->loop());
	et->expired_at( _stamp + _timeout );
	et->on_expired( tcode::transport::event_timer::handler(
			[tf]( const tcode::diagnostics::error_code& ec , const tcode::transport::event_timer& )	{
				tf->on_timer();
			}));
	et->fire();	
}
Beispiel #28
0
bool BatchCommands::ReadChain(const wxString & chain)
{
   // Clear any previous chain
   ResetChain();

   // Build the filename
   wxFileName name(FileNames::ChainDir(), chain, wxT("txt"));

   // Set the file name
   wxTextFile tf(name.GetFullPath());

   // Open and check
   tf.Open();
   if (!tf.IsOpened()) {
      // wxTextFile will display any errors
      return false;
   }

   // Load commands from the file
   int lines = tf.GetLineCount();
   if (lines > 0) {
      for (int i = 0; i < lines; i++) {

         // Find the command name terminator...ingore line if not found
         int splitAt = tf[i].Find(wxT(':'));
         if (splitAt < 0) {
            continue;
         }

         // Parse and clean
         wxString cmd = tf[i].Left(splitAt).Strip(wxString::both);
         wxString parm = tf[i].Mid(splitAt + 1).Strip(wxString::trailing);

         // Add to lists
         mCommandChain.Add(cmd);
         mParamsChain.Add(parm);
      }
   }

   // Done with the file
   tf.Close();

   return true;
}
void generateRandomTransform_ccd(FCL_REAL extents[6], std::vector<Transform3f>& transforms, std::vector<Transform3f>& transforms2, FCL_REAL delta_trans[3], FCL_REAL delta_rot, std::size_t n,
                                 const std::vector<Vec3f>& vertices1, const std::vector<Triangle>& triangles1,
                                 const std::vector<Vec3f>& vertices2, const std::vector<Triangle>& triangles2)
{
  transforms.resize(n);
  transforms2.resize(n);

  for(std::size_t i = 0; i < n;)
  {
    FCL_REAL x = rand_interval(extents[0], extents[3]);
    FCL_REAL y = rand_interval(extents[1], extents[4]);
    FCL_REAL z = rand_interval(extents[2], extents[5]);

    const FCL_REAL pi = 3.1415926;
    FCL_REAL a = rand_interval(0, 2 * pi);
    FCL_REAL b = rand_interval(0, 2 * pi);
    FCL_REAL c = rand_interval(0, 2 * pi);


    Matrix3f R;
    eulerToMatrix(a, b, c, R);
    Vec3f T(x, y, z);    
    Transform3f tf(R, T);

    std::vector<std::pair<int, int> > results;
    {
      transforms[i] = tf;

      FCL_REAL deltax = rand_interval(-delta_trans[0], delta_trans[0]);
      FCL_REAL deltay = rand_interval(-delta_trans[1], delta_trans[1]);
      FCL_REAL deltaz = rand_interval(-delta_trans[2], delta_trans[2]);

      FCL_REAL deltaa = rand_interval(-delta_rot, delta_rot);
      FCL_REAL deltab = rand_interval(-delta_rot, delta_rot);
      FCL_REAL deltac = rand_interval(-delta_rot, delta_rot);

      Matrix3f R2;
      eulerToMatrix(a + deltaa, b + deltab, c + deltac, R2);
      Vec3f T2(x + deltax, y + deltay, z + deltaz);
      transforms2[i].setTransform(R2, T2);
      ++i;
    }
  }
}
Beispiel #30
0
void CTileHandler::SaveData(ofstream& ofs)
{
	//write tile header
	MapTileHeader mth;
	mth.numTileFiles=(int)externalFiles.size()+1;
	mth.numTiles=usedTiles;
	ofs.write((char*)&mth,sizeof(MapTileHeader));

	//write external tile files used
	for(int fileNum=0;fileNum<(int)externalFiles.size();++fileNum){
		ofs.write((char*)&externalFileTileSize[fileNum],4);
		ofs.write(externalFiles[fileNum].c_str(),externalFiles[fileNum].size()+1);
	}
	//write new tile file to be created
	int internalTiles=usedTiles-numExternalTile;
	ofs.write((char*)&internalTiles,4);
	ofs.write(myTileFile.c_str(),myTileFile.size()+1);

	//write tiles
	for(int y=0; y<ysize/4; y++){
		for(int x=0; x<xsize/4; x++){
			int num = tileUse[x+y*xsize/4];
			ofs.write((char*)&num, sizeof(int));
		}
	}

	//create new tile file

	ofstream tf(myTileFile.c_str(),ios::binary | ios::out);

	TileFileHeader tfh;
	strcpy(tfh.magic,"spring tilefile");
	tfh.version=1;
	tfh.tileSize=32;
	tfh.compressionType=1;
	tfh.numTiles=internalTiles;

	tf.write((char*)&tfh,sizeof(TileFileHeader));

	for(int a=0;a<internalTiles;++a){
		tf.write(newTiles[a],SMALL_TILE_SIZE);
		delete[] newTiles[a];
	}
}