Dynamixel  2.9.5
RoadNarrows Robotics Dynamixel Package
DynaBgThread.cxx File Reference

Dynamixel background thread class. More...

#include <sys/time.h>
#include <time.h>
#include <limits.h>
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <iostream>
#include <map>
#include "rnr/rnrconfig.h"
#include "rnr/log.h"
#include "rnr/new.h"
#include "rnr/units.h"
#include "Dynamixel/Dynamixel.h"
#include "Dynamixel/MX.h"
#include "Dynamixel/DynaError.h"
#include "Dynamixel/DynaComm.h"
#include "Dynamixel/DynaServo.h"
#include "Dynamixel/DynaChain.h"
#include "Dynamixel/DynaBgThread.h"
#include "Dynamixel/DynaOlio.h"
#include "DynaLibInternal.h"

Go to the source code of this file.

Macros

#define BG_TRACE(mask, servoid, prefix, fmt, ...)
 No tracing output.
 
#define BG_TRACE_OPEN()
 No tracing file open.
 
#define BG_TRACE_CLOSE()
 No tracing file close.
 

Functions

static long dt_usec (struct timeval t1, struct timeval t0)
 Calculate the difference between two time-of-day times. More...
 

Detailed Description

Dynamixel background thread class.

LastChangedDate
2015-07-08 12:19:29 -0600 (Wed, 08 Jul 2015)
Rev
4024
Author
Robin Knight (robin.nosp@m..kni.nosp@m.ght@r.nosp@m.oadn.nosp@m.arrow.nosp@m.s.co.nosp@m.m)

Definition in file DynaBgThread.cxx.

Function Documentation

static long dt_usec ( struct timeval  t1,
struct timeval  t0 
)
static

Calculate the difference between two time-of-day times.

Parameters
t1Later time instance.
t0Earlier time instance.
Returns
Microsecond difference.

Definition at line 169 of file DynaBgThread.cxx.

Referenced by DynaBgThread::sched().

170 {
171  long dt;
172 
173  if( t1.tv_usec >= t0.tv_usec)
174  {
175  dt = (t1.tv_sec - t0.tv_sec) * 1000000 + (t1.tv_usec - t0.tv_usec);
176  }
177  else
178  {
179  dt = (t1.tv_sec - t0.tv_sec - 1) * 1000000 +
180  (1000000 + t1.tv_usec - t0.tv_usec);
181  }
182 
183  return dt;
184 }