From d28a5938d06f71dbb4fced6f2249acb65fd6dbe1 Mon Sep 17 00:00:00 2001 From: AydenBravender Date: Tue, 21 Jan 2025 13:58:29 -0700 Subject: [PATCH] Remapped controller --- .../moveit_spear/config/moveit_servo_config.yaml | 6 +++--- kipp_arm/src/teleop/teleop/moded_joy_arm.py | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/kipp_arm/src/moveit_spear/config/moveit_servo_config.yaml b/kipp_arm/src/moveit_spear/config/moveit_servo_config.yaml index c1158da..8449c71 100644 --- a/kipp_arm/src/moveit_spear/config/moveit_servo_config.yaml +++ b/kipp_arm/src/moveit_spear/config/moveit_servo_config.yaml @@ -4,10 +4,10 @@ command_in_type: "unitless" # "unitless"> in the range [-1:1], as if from joystick. "speed_units"> cmds are in m/s and rad/s scale: # Scale parameters are only used if command_in_type=="unitless" - linear: 0.2 # Max linear velocity. Unit is [m/s]. Only used for Cartesian commands. - rotational: 8.0 # Max angular velocity. Unit is [rad/s]. Only used for Cartesian commands. + linear: 1.5 # Max linear velocity. Unit is [m/s]. Only used for Cartesian commands. + rotational: 0.9 # Max angular velocity. Unit is [rad/s]. Only used for Cartesian commands. # Max joint angular/linear velocity. Only used for joint commands on joint_command_in_topic. - joint: 0.9 + joint: 1.5 # Optionally override Servo's internal velocity scaling when near singularity or collision (0.0 = use internal velocity scaling) # override_velocity_scaling_factor = 0.0 # valid range [0.0:1.0] diff --git a/kipp_arm/src/teleop/teleop/moded_joy_arm.py b/kipp_arm/src/teleop/teleop/moded_joy_arm.py index a47550f..c197e23 100644 --- a/kipp_arm/src/teleop/teleop/moded_joy_arm.py +++ b/kipp_arm/src/teleop/teleop/moded_joy_arm.py @@ -124,10 +124,10 @@ def ConvertJoyToCommand(self): eef_open_msg.data = self.joystick_msg.axes[RIGHT_BUMPER] self.publisher_.publish(eef_open_msg) - if self.joystick_msg.buttons[RIGHT_TRIGGER]: + if self.joystick_msg.buttons[LEFT_BUMPER]: i += 1 eef_close_msg = Float32() - eef_close_msg.data = -self.joystick_msg.axes[RIGHT_TRIGGER] + eef_close_msg.data = -self.joystick_msg.axes[LEFT_BUMPER] self.publisher_.publish(eef_close_msg) if i > 0: @@ -145,9 +145,10 @@ def publish_twist_command(self): self.twist_msg.header.stamp = self.get_clock().now().to_msg() self.twist_msg.header.frame_id = "base_link" - lin_x_left_bumper = (self.joystick_msg.buttons[LEFT_BUMPER]) - lin_x_left_trigger = -0.5 * (self.joystick_msg.axes[LEFT_TRIGGER]+1) - lin_x = lin_x_left_bumper + lin_x_left_trigger + lin_x_right_trigger = -0.5 * (self.joystick_msg.axes[RIGHT_TRIGGER]+1) + self.get_logger().info(f"RIGHT {lin_x_right_trigger}") + lin_x_left_trigger = 0.5 * (self.joystick_msg.axes[LEFT_TRIGGER]+1) + lin_x = lin_x_right_trigger + lin_x_left_trigger if abs(lin_x) > deadband_threshold or abs(self.joystick_msg.axes[LEFT_STICK_Y]) > deadband_threshold or abs(self.joystick_msg.axes[LEFT_STICK_X]) > deadband_threshold: self.twist_msg.twist.linear.z = -self.joystick_msg.axes[LEFT_STICK_Y] @@ -172,6 +173,8 @@ def publish_joint_command(self): def JoystickMsg(self, msg): self.joystick_msg = msg + self.get_logger().info(f"Joystick Axes Values: {msg.axes}") + self.get_logger().info(f"Joystick Button Values: {msg.buttons}") def main(args=None): rclpy.init(args=args)