[openrtm-commit:01046] r2385 - branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux
openrtm @ openrtm.org
openrtm @ openrtm.org
2013年 4月 15日 (月) 20:39:46 JST
Author: n-ando
Date: 2013-04-15 20:39:45 +0900 (Mon, 15 Apr 2013)
New Revision: 2385
Modified:
branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/ArtExecutionContext.cpp
branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/ArtExecutionContext.h
branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/Makefile.am
Log:
Now ART-EC has .priority and .art.priority option for priority setting. refs #2638
Modified: branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/ArtExecutionContext.cpp
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/ArtExecutionContext.cpp 2013-04-15 11:30:49 UTC (rev 2384)
+++ branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/ArtExecutionContext.cpp 2013-04-15 11:39:45 UTC (rev 2385)
@@ -29,8 +29,16 @@
namespace RTC
{
ArtExecutionContext::ArtExecutionContext()
- : PeriodicExecutionContext()
+ : PeriodicExecutionContext(),
+ m_priority(ART_PRIO_MAX-1)
{
+ rtclog.setName("ArtEC");
+ coil::Properties& prop(Manager::instance().getConfig());
+
+ // Priority
+ getProperty(prop, "exec_cxt.periodic.priority", m_priority);
+ getProperty(prop, "exec_cxt.periodic.art.priority", m_priority);
+ RTC_DEBUG(("Priority: %d", m_priority));
}
ArtExecutionContext::~ArtExecutionContext()
@@ -41,23 +49,22 @@
int ArtExecutionContext::svc(void)
{
int usec(m_period.sec() * 1000000 + m_period.usec());
- if (art_enter(ART_PRIO_MAX-1, ART_TASK_PERIODIC, usec) == -1)
+ if (art_enter(m_priority, ART_TASK_PERIODIC, usec) == -1)
{
- std::cerr << "fatal error: art_enter" << std::endl;
+ std::cerr << "fatal error: art_enter" << std::endl;
}
do
{
- std::for_each(m_comps.begin(), m_comps.end(), invoke_worker());
- // while (!m_running) {ACE_OS::sleep(tv);}
- if (art_wait() == -1)
- {
- std::cerr << "fatal error: art_wait " << std::endl;
- }
+ std::for_each(m_comps.begin(), m_comps.end(), invoke_worker());
+ if (art_wait() == -1)
+ {
+ std::cerr << "fatal error: art_wait " << std::endl;
+ }
} while (m_running);
if (art_exit() == -1)
{
- std::cerr << "fatal error: art_exit" << std::endl;
+ std::cerr << "fatal error: art_exit" << std::endl;
}
return 0;
}
@@ -69,8 +76,7 @@
void ArtExecutionContextInit(RTC::Manager* manager)
{
RTC::Manager::instance().registerECFactory("ArtExecutionContext",
- RTC::ECCreate<RTC::ArtExecutionContext>,
- RTC::ECDelete<RTC::ArtExecutionContext>);
-
+ RTC::ECCreate<RTC::ArtExecutionContext>,
+ RTC::ECDelete<RTC::ArtExecutionContext>);
}
};
Modified: branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/ArtExecutionContext.h
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/ArtExecutionContext.h 2013-04-15 11:30:49 UTC (rev 2384)
+++ branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/ArtExecutionContext.h 2013-04-15 11:39:45 UTC (rev 2385)
@@ -1,4 +1,4 @@
-// -*- C++ -*-
+l// -*- C++ -*-
/*!
* @file ArtExecutionContext.h
* @brief ArtExecutionContext class
@@ -38,6 +38,22 @@
ArtExecutionContext();
virtual ~ArtExecutionContext();
virtual int svc(void);
+
+ template <class T>
+ void getProperty(coil::Properties& prop, const char* key, T& value)
+ {
+ if (prop.findNode(key) != 0)
+ {
+ T tmp;
+ if (coil::stringTo(tmp, prop[key].c_str()))
+ {
+ value = tmp;
+ }
+ }
+ }
+
+ private:
+ int m_priority;
};
};
Modified: branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/Makefile.am
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/Makefile.am 2013-04-15 11:30:49 UTC (rev 2384)
+++ branches/RELENG_1_1/OpenRTM-aist/src/ext/ec/artlinux/Makefile.am 2013-04-15 11:39:45 UTC (rev 2385)
@@ -19,7 +19,7 @@
module_LTLIBRARIES = ArtExecutionContext.la
ArtExecutionContext_la_SOURCES = ArtExecutionContext.cpp ArtExecutionContext.h
-ArtExecutionContext_la_LDFLAGS = -module -shared
+ArtExecutionContext_la_LDFLAGS = -module -shared $(ARTLIB)
ArtExecutionContext_la_FLAGS = -L$(top_builddir)/src/lib/rtm/.lib
ArtExecutionContext_la_LIBADD = $(top_builddir)/src/lib/rtm/libRTC.la
More information about the openrtm-commit
mailing list