Skip to content
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

set start_position as current_pos and make sure the joints with enabled torque #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,18 @@ def process_trajectory(self, traj):
rospy.logerr(msg)
self.action_server.set_aborted(text=msg)
return

# make sure the joints with enabled torque
multi_packet_torque={}
for port, joints in self.port_to_joints.items():
vals=[]
for joint in joints:
motor_id=self.joint_to_controller[joint].motor_id
vals.append((motor_id, True))
multi_packet_torque[port] = vals

for port, vals in multi_packet_torque.items():
self.port_to_io[port].set_multi_torque_enabled(vals)

# correlate the joints we're commanding to the joints in the message
# map from an index of joint in the controller to an index in the trajectory
Expand Down Expand Up @@ -252,7 +264,6 @@ def process_trajectory(self, traj):
j = self.joint_names.index(joint)

start_position = self.joint_states[joint].current_pos
if seg != 0: start_position = trajectory[seg - 1].positions[j]

desired_position = trajectory[seg].positions[j]
desired_velocity = max(self.min_velocity, abs(desired_position - start_position) / durations[seg])
Expand Down