[openrtm-commit:01045] r2384 - branches/RELENG_1_0/OpenRTM-aist/src/ext/artlinux/art_ec
openrtm @ openrtm.org
openrtm @ openrtm.org
2013年 4月 15日 (月) 20:30:49 JST
Author: n-ando
Date: 2013-04-15 20:30:49 +0900 (Mon, 15 Apr 2013)
New Revision: 2384
Modified:
branches/RELENG_1_0/OpenRTM-aist/src/ext/artlinux/art_ec/ArtExecutionContext.cpp
branches/RELENG_1_0/OpenRTM-aist/src/ext/artlinux/art_ec/ArtExecutionContext.h
Log:
Now ART-EC has .priority and .art.priority option for priority setting.
Modified: branches/RELENG_1_0/OpenRTM-aist/src/ext/artlinux/art_ec/ArtExecutionContext.cpp
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist/src/ext/artlinux/art_ec/ArtExecutionContext.cpp 2013-04-15 11:03:09 UTC (rev 2383)
+++ branches/RELENG_1_0/OpenRTM-aist/src/ext/artlinux/art_ec/ArtExecutionContext.cpp 2013-04-15 11:30:49 UTC (rev 2384)
@@ -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()
@@ -40,8 +48,8 @@
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)
+ int usec = static_cast<int>(1.0e6 / m_profile.rate);
+ if (art_enter(m_priority, ART_TASK_PERIODIC, usec) == -1)
{
std::cerr << "fatal error: art_enter" << std::endl;
}
Modified: branches/RELENG_1_0/OpenRTM-aist/src/ext/artlinux/art_ec/ArtExecutionContext.h
===================================================================
--- branches/RELENG_1_0/OpenRTM-aist/src/ext/artlinux/art_ec/ArtExecutionContext.h 2013-04-15 11:03:09 UTC (rev 2383)
+++ branches/RELENG_1_0/OpenRTM-aist/src/ext/artlinux/art_ec/ArtExecutionContext.h 2013-04-15 11:30:49 UTC (rev 2384)
@@ -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;
};
};
More information about the openrtm-commit
mailing list