RussTedrake / manipulation

Course notes for MIT manipulation class
BSD 3-Clause "New" or "Revised" License
418 stars 123 forks source link

`IiwaDriver`: Create controller MBP from scenario file #317

Closed siddancha closed 4 months ago

siddancha commented 4 months ago

Fixes #316


This change is Reviewable

siddancha commented 4 months ago

There is currently an issue with plant.GetJointActuatorIndices(child_instance) that returns an empty list. Therefore, the actuators aren't actually removed in:

# remove joint actuators
for actuator_index in plant.GetJointActuatorIndices(child_instance):  # list is empty
    actuator = plant.get_joint_actuator(actuator_index)
    plant.RemoveJointActuator(actuator)

I needed to explicitly add the following to get it to work locally:

for actuator in [
        plant.GetJointActuatorByName('left_finger_sliding_joint', child_instance),
        plant.GetJointActuatorByName('right_finger_sliding_joint', child_instance)
    ]:
    plant.RemoveJointActuator(actuator)

Seems like a potential bug MultibodyPlant::GetJointActuatorIndices(child_instance), and is what is causing the tests to fail. Will dig into this and potentially raise an issue on the drake's Github.

siddancha commented 4 months ago

Added GetJointActuatorIndices bug report and a simple reproduction here: https://github.com/RobotLocomotion/drake/issues/21547

siddancha commented 4 months ago

Realized from bug report (https://github.com/RobotLocomotion/drake/issues/21547) that GetJointActuatorIndices(model_instance) cannot be used pre-finalize. Using @jwnimmer-tri 's solution to call plant.GetJointActuatorIndices() and remove the actuators corresponding to the joints to be removed.

RussTedrake commented 4 months ago

thanks! ironically, i already did all this in https://github.com/RussTedrake/manipulation/blob/master/book/mobile/exercises/mobile_base_ik.ipynb will review this morning.

RussTedrake commented 4 months ago

pyproject.toml line 5 at r4 (raw file):

Previously, siddancha (Siddharth Ancha) wrote…
If it's not a hassle/concern? Otherwise I can just also do `pip install git+https://github.com/RussTedrake/manipulation@master` and not rely on PyPI releases.

Done. (i've pushed to pypi)