-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Force-Gated Position and Velocity Controllers #28
Conversation
@egordon, two discussion points:
|
(1) This is 100% the better way to do it. The reason we didn't do it before is that, at the time, the Lmk if you want help with that the force-gate JTC. (2) I agree that this is not necessarily a problem. Consider how servo vs. planning handles collisions: in planning, if there is a collision, planning fails. But with servo, if there is a collision, you can still control the robot, but just not in the direction of the collision object. I think this mirrors that behavior. I don't think (ii) is necessary, but if you want to add a parameter that doesn't affect older functionality, I'm not going to stop you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will be fine and is safe to merge since it is purely additive. Only comment I think should be addressed is the multi-subscriber.
force_gate_controller/CMakeLists.txt
Outdated
@@ -31,10 +34,18 @@ generate_parameter_library(force_gate_controller_parameters | |||
src/force_gate_controller_parameters.yaml | |||
include/force_gate_controller/validate_jtc_parameters.hpp | |||
) | |||
# generate_parameter_library(force_gate_position_velocity_controller_parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary comment?
force_gate_controller/CMakeLists.txt
Outdated
@@ -43,13 +54,15 @@ target_include_directories(force_gate_controller PUBLIC | |||
) | |||
target_link_libraries(force_gate_controller PUBLIC | |||
force_gate_controller_parameters | |||
# force_gate_position_velocity_controller_parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary comment?
force_gate_controller/CMakeLists.txt
Outdated
@@ -97,6 +110,7 @@ install( | |||
install(TARGETS | |||
force_gate_controller | |||
force_gate_controller_parameters | |||
# force_gate_position_velocity_controller_parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flagging this too
A ControllerAllocator for the force gates joint trajectory controller, to enable it to be controlled by MoveIt's Ros2ControlManager. | ||
</description> | ||
</class> | ||
</library> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline
The joint group position controller executes joint-space trajectories on a set of joints and allows for Force / Torque safety thresholding. | ||
</description> | ||
</class> | ||
</library> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline
wrench_tolerances_.torqueVec[2] = force_gate_params_.wrench_threshold.tz; | ||
|
||
// Subscribe to wrench topic | ||
wrench_subscriber_ = node->create_subscription<geometry_msgs::msg::WrenchStamped>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Force gate JTC makes the subscriber once in on_configure()
. This will re-make it every time the parameters are read/updated. I would wrap this in an if wrench_subscriber_ != nullptr
.
Recall that the topic is defined to be read-only in the parameters file, so you should never have to re-make the subscriber in the lifetime of the controller.
{ | ||
if (!check_wrench_threshold(get_node(), get_node()->now())) | ||
{ | ||
return controller_interface::return_type::ERROR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe clarify how this affects the life-cycle here.
This transitions to on_error()
, and receiving a new command transitions it back to running?
The JTC bug has not yet been backported to humble. I made Issue #29 to move to an inheritance model once that is backported. |
Description
As it stands, this package only implements a force-gated joint trajectory controller (specifically, a force-gated version of this controller). However, for MoveIt Servo to work well on the real robot, it needs to use a streaming controller, either a JointGroupPositionController or a JointGroupVelocityController. This PR adds force-gated versions of those two controllers.
Further, in order to have MoveIt's controller manager manage controllers not used by MoveGroup (i.e., the streaming controller used by MoveIt Servo), we needed to switch
moveit_simple_controller_manager/MoveItSimpleControllerManager
tomoveit_ros_control_interface/Ros2ControlManager
(done in ada_ros2#23). This further requires the force-gated joint trajectory controller to be wrapped in a class that inherits frommoveit_ros_control_interface::ControllerHandleAllocator
. This PR makes that change as well.Design Decisions
The force-gated joint trajectory controller (JTC) was implemented by copying the code for the standard joint trajectory controller, and then adding the force-gating. This approach has the following downsides:
Therefore, when implementing the force-gated position and velocity controllers, I instead inherit from the base controllers, and merely modify the functions that need to be for force-gating. In doing so, I define a parent class,
ForceGateParent
, that isolates the functions specific to force-gating. In theory, we should be able to force-gate any controller with few lines of code by using theForceGateParent
class and following the inheritance patterns in the force-gated position/velocity controllers.Testing
Setup:
ros2 run ada_feeding dummy_ft_sensor.py
ros2 run forque_sensor_hardware forque_sensor_hardware
ros2 launch ada_moveit demo.launch.py sim:=mock
ros2 launch ada_moveit demo.launch.py
ros2 service call /wireless_ft/set_bias std_srvs/srv/SetBool "{data: true}"
Testing:
ros2 service call /controller_manager/switch_controller controller_manager_msgs/srv/SwitchController "{activate_controllers: [\"jaco_arm_servo_controller\"], deactivate_controllers: [\"jaco_arm_controller\"], start_controllers: [], stop_controllers: [], strictness: 0, start_asap: false, activate_asap: false, timeout: {sec: 0, nanosec: 0}}"
ros2 service call /servo_node/start_servo std_srvs/srv/Trigger "{}"
ros2 run ada_moveit ada_keyboard_teleop.py
hand
and then toggle off and on theMotionPlanning
element in RVIZ.)ros2 service call /servo_node/stop_servo std_srvs/srv/Trigger "{}"