package_template package¶
Submodules¶
package_template.pid module¶
Brief description of the pid module.
More advanced description of this module, e.g. This module contains a 1D PID controller and utilities for managing the gains and the controller parameters.
Copyright (c) 2017-2019, New York University and Max Planck Gesellschaft, License BSD-3-Clause
- class package_template.pid.ConfigFileConfiguration[source]¶
Bases:
object
Path to default configuration file, relative to the pid package
- relative_path = 'config/test_pid_gains.yaml'¶
- class package_template.pid.DefaultConfiguration[source]¶
Bases:
object
PID configuration
Configuration object with default values for kp, kd and ki can be used as input argument to create an instance of PID
- kp¶
Proportional gain.
- kd¶
Derivative gain.
- ki¶
Integral gain.
- kd = 1¶
- ki = 1¶
- kp = 1¶
- class package_template.pid.PythonPID(configuration)[source]¶
Bases:
object
Simple 1D PID controller
- _configuration¶
The PID gains.
- _integral¶
The integral term.
- compute(position, velocity, position_target, delta_time)[source]¶
Compute the force related to the pid controller.
This function is not stateless, as it performs integration. Call reset_integral() to reset the integral part.
- Parameters
position – Float – current position
velocity – Float – current velocity
position_target – Float – target position
delta_time – Float – time passed since last measurement. Used for integral computation
- Returns
Float – computed force
- class package_template.pid.RosConfiguration[source]¶
Bases:
object
ROS param configuration
This contains the name of the ros parameter server keys for the PID gains.
- ROSPARAM_KP¶
Key for reading kp gain.
- ROSPARAM_KD¶
Key for reading kd gain.
- ROSPARAM_KI¶
Key for reading ki gain.
- ROSPARAM_KD = 'kd'¶
- ROSPARAM_KI = 'ki'¶
- ROSPARAM_KP = 'kp'¶
- package_template.pid.get_config_file_pid(config_file_path=None, verbose=True)[source]¶
Reads a yaml file and return a corresponding PID controller.
- Parameters
config_file_path – str – Path to configuration file relative to the script where this function is defined is specified in the ConfigFileConfiguration object. If None, uses default config file (in config folder), else used specified path
verbose – Bool – If True, prints path to config file used to standard output
- Returns
PID – A PID based on gains read from default configuration file
- package_template.pid.get_default_pid()[source]¶
Factory for default PID controller.
See PID and see DefaultConfiguration.
- Returns
PID – a new PID controller based on the DefaultConfiguration.
- package_template.pid.get_ros1_params_pid(verbose=True)[source]¶
Get a PID controller parameterized through ROS params
Assumes roscore is running and suitable parameters have been written in the server.
- Parameters
verbose – Bool – True: prints (stdout) the ros parameters it reads.
- Returns
PID – A PID object based on gains read from the ROS parameter server.
Module contents¶
package_template Contains an example of a python package.