Project

General

Profile

バグ #3651

実行周期を0に設定してもBAD_PARAMETERを返さない問題

Added by n-miyamoto over 5 years ago. Updated almost 5 years ago.

Status:
終了
Priority:
通常
Assignee:
Target version:
-
Start date:
10/06/2016
Due date:
% Done:

100%

Estimated time:

Description

C++版の以下のチケット同じ問題

#3650

実行周期に0を指定した時にBAD_PARAMETERを返すようにする。

問題箇所はExecutionContextProfileクラスのsetRate関数、setPeriod関数

  def setRate(self, rate):
    self._rtcout.RTC_TRACE("setRate(%f)", rate)
    if rate <= 0.0:
      return RTC.BAD_PARAMETER

    guard = OpenRTM_aist.ScopedLock(self._profileMutex)
    self._profile.rate = rate
    self._period = OpenRTM_aist.TimeValue(1.0 / rate)
    return RTC.RTC_OK

  def setPeriod(self, sec=None, tv=None):
    if sec:
      self._rtcout.RTC_TRACE("setPeriod(%f [sec])", sec)
      if sec < 0.0:
        return RTC.BAD_PARAMETER

      guard = OpenRTM_aist.ScopedLock(self._profileMutex)
      self._profile.rate = 1.0 / sec
      self._period = OpenRTM_aist.TimeValue(sec)
      del guard
      return RTC.RTC_OK;
    elif tv:
      self._rtcout.RTC_TRACE("setPeriod(%f [sec])", tv.toDouble())
      if tv.toDouble() < 0.0:
        return RTC.BAD_PARAMETER

      guard = OpenRTM_aist.ScopedLock(self._profileMutex)
      self._profile.rate = 1.0 / tv.toDouble()
      self._period = tv
      del guard
      return RTC.RTC_OK
    return RTC.BAD_PARAMETER

Associated revisions

Revision 722 (diff)
Added by miyamoto over 5 years ago

[compat,bugfix] refs #3651

History

#1 Updated by n-miyamoto almost 5 years ago

  • Status changed from 新規 to 解決
  • % Done changed from 0 to 100

#2 Updated by n-ando almost 5 years ago

  • Status changed from 解決 to 終了

Also available in: Atom PDF