C++代写:COMP3017 Arm Controller

考虑TurtleBot的手臂调节问题,实现ROS节点,对目标配置实施补偿控制。

TurtleBot

Requirement

In this programming task we consider the regulation of the TurtleBot3 arm. The aim is to implement a ROS node that implements a compensation control according to a transferred target configuration at the joint level. A PID controller should be used as the rule specification. Implement the following functions to control the TurtleBot3 arm in the ArmController class (arm_controller.cpp, arm_controller.h).

Receive setpoint and joint condition

First, the variables relevant for the regulation must be received via the corresponding messages. The callback method ArmController :: goalPositionCb for the target values to be controlled is already defined and assigned to the message via the subscriber. There you save the received target position from the transferred message goal_msg (of the type std_msgs :: Float64) into the variable goal_position_ of the data type std :: map1, with the joint name joint_name also transferred as the key.
Now expand the constructor with the subscriber joint_state_sub_, which registers itself on the topic “joint_states” and uses the ArmController :: jointStateCb method as callback (queue size should be 1). Then, in the callback method, assign the joint position and speed received via the message joint_state_msgs (of the type sensor_msgs :: JointState2) to the member variables current_position_ and current_velocity_.

PID

In the updateJoint () method, implement a PID control for each joint, based on the current joint positions and speeds. The function receives the joint name joint_name, the time difference to the last control update delta_time and writes the current control output in effort_clamped and the current control error in position_error.
The control parameters are available via the variables p_, i_ and d_ with the name of the joint currently being viewed as the key. Limit the controller output to the range [-max_effort_, max_effort_] according to the manipulated variable limitation. Zero should be assumed as the setpoint for the speed. The error for the I component should be integrated with the trapezoidal rule. You can adjust the control parameters via the configuration file “config / arm_controller_config.yaml” for test purposes.

Anti-windup

In a system with manipulated variable limitation, the windup effect occurs with the PID controller. Here the position error is still integrated, although the manipulated variable is in saturation and thus no change at the controller output results. This can lead to unstable system behavior and strong Cause overshoot. Therefore, implement the anti-windup strategy known from the lecture strategy with the gain factor kaw = 1 / ki.

Hints

Start

  • Simulation start roslaunch turtlebot3_arm_controller_exercise start_sim.launch
  • start the exercise: roslaunch turtlebot3_arm_controller_exercise arm_controller.launch

The Multiplot plugin is loaded in the rqt window that opens (see Figure 1). For this to be displayed correctly, the display configuration “arm_joints_data.xml” provided in the “config” folder must be loaded using the “Open Configuration” button (top right). The absolute path to this file is stored in the “arm_controller.perspective” which is also in the “config” folder and can be entered there if necessary.

To perform a movement, the steps marked in Figure 1 must be carried out.

  1. Resume the paused simulation
  2. Load the controller to be used by setting the “controller manager ns” with “/ turtle- bot3 / joints / controller_manager “and the controller” arm_trajectory_controller “
  3. Activate the trajectory calculation
  4. Start the multiplot
  5. Now new joint angle specifications can be made using the slider or by entering numbers directly be made.

You can also solve the methods to be implemented using the tests provided check without using the Turtlebot simulation.
Note: The tests only cover part of the required functionality. Additional tests and a qualitative evaluation of the plots are used to evaluate the exercise.
Note: The tests are based on the given PID parameters. Adjusting the PID parameters will cause the tests to fail.

Build and run the tests: turtle test turtlebot3_arm_controller_exercise arm_controller.test