Skip to content

Commit

Permalink
src pid folder
Browse files Browse the repository at this point in the history
  • Loading branch information
eliabntt committed May 19, 2021
1 parent 7f2123c commit 1c58677
Show file tree
Hide file tree
Showing 20 changed files with 2,266 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/pid
Submodule pid deleted from 8268b7
89 changes: 89 additions & 0 deletions src/pid/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package pid
^^^^^^^^^^^^^^^^^^^^^^^^^

0.0.28 (2020-07-03)
-------------------
* Fix compatibility issues when building with ROS Noetic
* Bug fix for angle wrapping always resetting filtered and integral error
* Adding a parameter setpoint_timeout which specifies whether to keep publishing control_effort messages after setpoint messages stop coming in
* Add link to low-pass filter reference
* Cleaning up package.xml just a bit more.
* Removing a bunch of superfluous dependencies.
* Cleaning CMakeLists.
* Upgrade to package format=2
* Contributors: Andrew J Zelenak, AndyZe, Stewart Jamieson, Vikrant Shah

0.0.15 (2016-02-22)
-------------------
* Fixing header "include" error, possible dynamic_reconfigure errors.
* Contributors: Andy Zelenak

0.0.10 (2016-1-25)
------------------
* Add diagnostics running at 4Hz. Publish interesting data like setpoint, plant state,
error, control effort in diags for viewing
* Add ROS private parameters to set Pid params and simulator param
* Add Auto/Manual mode: Listen to the /pid_enable topic for a std_msgs/Bool
that will disable or re-enable output from the PID controller
* Support reverse_acting parameter, for plants where the control input acts
in the opposite direction to the plant-state. E.g. Differential-drive robots
often have one direct and one reverse-acting PID
* Support faster-than-wallclock simulation via a /clock publisher and the
/use_sim_time parameter
* Add launch files for first & 2nd order behaviors. Get them to launch plots,
diag monitor, reconfigure gui
* Split setpoint generator out into a separate node
* Rename simulator to plant_sim.cpp & give it 1st & 2nd order behaviors, configured
with a parameter.
* Delete first_order_plant_sim.cpp, which is subsumed into plant_sim.cpp. Remove
plant header, which was almost content-free.
* Remove msg directory & switch to using Float64 messages for setpoint,
process state, & control effort. Now it's generic - no special messages needed.
* Explicitly call out std namespace to avoid accidental name conflicts
* Remove parameter length checks to allow parameters to be set in part from
launch file (the usual way), and in part from cmd line args (an infrequently-used
way)
* Rename pid_header.h to controller.h because it's used by controller.cpp - more standard
C++ naming style
* Add copyrights
* Contributors: AndyZe, Paul Bouchier

0.0.9 (2015-12-27)
------------------
* Merged in bouchier/pid (pull request #1)
Add dynamic reconfigure for Kx, change plant setpoint
* add dynamic reconfigure for Kx, change plant setpoint
* Contributors: AndyZe, Paul Bouchier

0.0.7 (2015-07-26)
------------------
* Added a launch file, which required the arguments to be processed differently.
* Contributors: Andy Zelenak

0.0.6 (2015-06-09)
------------------
* Changing the way parameters are passed to check_user_input().
* Contributors: Andy Zelenak

0.0.5 (2015-06-09)
------------------
* Adding an anti-windup option.
* Contributors: Andy Zelenak

0.0.3 (2015-03-14)
------------------

0.0.2 (2015-03-13)
------------------

0.0.1 (2015-03-08)
------------------
* Fixing various minor bugs related to user input.
* Pre-release commit.
* It WORKS!
* It's talking with the plant sim now. Just the PID programming remains.
* Making progress with the command line input.
* Rough outline of the program. Need to take inputs on the command line next.
* Initial commit
* Contributors: Andy Zelenak
57 changes: 57 additions & 0 deletions src/pid/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
cmake_minimum_required(VERSION 2.8.3)
project(pid)

add_compile_options(-std=c++11)

find_package(catkin REQUIRED COMPONENTS
roscpp
dynamic_reconfigure
)
find_package(Boost REQUIRED COMPONENTS system)

generate_dynamic_reconfigure_options(
cfg/Pid.cfg
)

catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS roscpp std_msgs message_runtime dynamic_reconfigure
)

include_directories(include
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${dynamic_reconfigure_PACKAGE_PATH}/cmake/cfgbuild.cmake
)

add_executable(controller src/controller.cpp src/pid.cpp)
add_executable(plant_sim src/plant_sim.cpp)
add_executable(setpoint_node src/setpoint_node.cpp)
add_executable(sim_time src/sim_time.cpp)
add_executable(autotune src/autotune.cpp)

add_dependencies(controller ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(plant_sim ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(setpoint_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(sim_time ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
add_dependencies(autotune ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

target_link_libraries(controller ${catkin_LIBRARIES})
target_link_libraries(plant_sim ${catkin_LIBRARIES})
target_link_libraries(setpoint_node ${catkin_LIBRARIES})
target_link_libraries(sim_time ${catkin_LIBRARIES})
target_link_libraries(autotune ${catkin_LIBRARIES})

install(TARGETS controller plant_sim setpoint_node sim_time autotune
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)

install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
)
20 changes: 20 additions & 0 deletions src/pid/cfg/Pid.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python
PACKAGE = "pid"

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()
K_scale_enum = gen.enum([ gen.const("scale_tenth", double_t, 0.1, "Scale by 0.1"),
gen.const("scale_unity", double_t, 1.0, "No scaling"),
gen.const("scale_ten", double_t, 10.0, "Scale by 10"),
gen.const("scale_hundred", double_t, 100.0, "Scale by 100")],
"Scale factor for K setting")

gen.add("Kp_scale", double_t, 0, "Kp scale", 10, 0.1, 100, edit_method = K_scale_enum)
gen.add("Kp", double_t, 0, "Kp", 0.1, -1, 1)
gen.add("Ki_scale", double_t, 0, "Ki scale", 10, 0.1, 100, edit_method = K_scale_enum)
gen.add("Ki", double_t, 0, "Ki", 0.1, -1, 1)
gen.add("Kd_scale", double_t, 0, "Kd scale", 10, 0.1, 100, edit_method = K_scale_enum)
gen.add("Kd", double_t, 0, "Kd", 0.1, -1, 1)

exit(gen.generate(PACKAGE, "pid", "Pid"))
2 changes: 2 additions & 0 deletions src/pid/contributors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Andy Zelenak
Paul Bouchier
Loading

0 comments on commit 1c58677

Please sign in to comment.