Difference between revisions of "Creating PID Tuning Graphs"

From wikidb
Jump to: navigation, search
Line 4: Line 4:
 
motors and robot speed. It is used to help calibrate PID parameters. I didn't know how to configure
 
motors and robot speed. It is used to help calibrate PID parameters. I didn't know how to configure
 
rqt_plot to display snapshots.
 
rqt_plot to display snapshots.
 +
 +
= Message Additions to the Motor Controller =
 +
 +
A "wheels" message of type Float64MultiArray is published in the setMotorPower function. It has
 +
five elements.
 +
 +
* data[0]: time is seconds since the motor controller was started.
 +
* data[1]: wheel 0 speed in m/sec
 +
* data[2]: percent of full power applied to wheel 0
 +
* data[3]: wheel 1 speed
 +
* data[4]: wheel 1 power
 +
 +
 +
 +
ros::Publisher wheel_pub_;
 +
 +
wheel_pub_ = n.advertise<std_msgs::Float64MultiArray>("wheels", 100);
 +
 +
    std_msgs::Float64MultiArray wheel_data;
 +
    wheel_data.data.clear();
 +
    ros::Time odom_time(odom_.header.stamp.sec, odom_.header.stamp.nsec);
 +
    ros::Duration elapsed_time = odom_time - beginning_time_;
 +
    wheel_data.data.push_back(elapsed_time.toSec());
 +
    wheel_data.data.push_back(wheel0_speed);
 +
    wheel_data.data.push_back(power_wheel0_);
 +
    wheel_data.data.push_back(wheel1_speed);
 +
    wheel_data.data.push_back(power_wheel1_);
 +
    wheel_pub_.publish(wheel_data);
 +
  
 
= Plot termination Criteria =
 
= Plot termination Criteria =

Revision as of 13:09, 22 September 2017

Overview

This page documents a Python program designed to graph the first few seconds of power applied to the motors and robot speed. It is used to help calibrate PID parameters. I didn't know how to configure rqt_plot to display snapshots.

Message Additions to the Motor Controller

A "wheels" message of type Float64MultiArray is published in the setMotorPower function. It has five elements.

  • data[0]: time is seconds since the motor controller was started.
  • data[1]: wheel 0 speed in m/sec
  • data[2]: percent of full power applied to wheel 0
  • data[3]: wheel 1 speed
  • data[4]: wheel 1 power


ros::Publisher wheel_pub_;

wheel_pub_ = n.advertise<std_msgs::Float64MultiArray>("wheels", 100);

    std_msgs::Float64MultiArray wheel_data;
    wheel_data.data.clear();
    ros::Time odom_time(odom_.header.stamp.sec, odom_.header.stamp.nsec);
    ros::Duration elapsed_time = odom_time - beginning_time_;
    wheel_data.data.push_back(elapsed_time.toSec());
    wheel_data.data.push_back(wheel0_speed);
    wheel_data.data.push_back(power_wheel0_);
    wheel_data.data.push_back(wheel1_speed);
    wheel_data.data.push_back(power_wheel1_);
    wheel_pub_.publish(wheel_data);


Plot termination Criteria

There are two termination criteria for termination 1) cnt-c and 2) time. After one of the criteria is met, the graph is drawn.