Commit 87872a58 authored by Thomas Moulard's avatar Thomas Moulard Committed by Florent Lamiraux florent@laas.fr
Browse files

Add tools.py file containing addTrace.

parent 810ad4a7
......@@ -111,6 +111,7 @@ SET (PYTHON_SOURCES
dynamic_graph/signal_base.py
dynamic_graph/matlab.py
dynamic_graph/script_shortcuts.py
dynamic_graph/tools.py
)
SET (PYTHON_SOURCES_FULLPATH "")
......
# -*- coding: utf-8 -*-
# Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
#
# This file is part of dynamic-graph.
# dynamic-graph is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# dynamic-graph is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Lesser Public License for more details. You should have
# received a copy of the GNU Lesser General Public License along with
# dynamic-graph. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function
def addTrace(robot, trace, entityName, signalName, autoRecompute = True):
"""
Add a signal to a tracer and recompute it automatically if necessary.
"""
signal = '{0}.{1}'.format(entityName, signalName)
filename = '{0}-{1}'.format(entityName, signalName)
trace.add(signal, filename)
if autoRecompute:
robot.device.after.addSignal(signal)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment