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

support impedance control on simulator #336

Open
wants to merge 1 commit into
base: indigo-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
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
26 changes: 26 additions & 0 deletions nextage_description/models/main.dae
Original file line number Diff line number Diff line change
Expand Up @@ -6444,6 +6444,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</frame_origin>
</technique>
</extra>
<extra name="lhsensor" type="attach_sensor">
<technique profile="OpenRAVE">
<instance_sensor url="#sensor5"/>
<frame_origin link="kmodel1/link15">
<translate>0 0 0</translate>
<rotate>0.57737 0.57735 0.57735 2.0944</rotate>
</frame_origin>
</technique>
</extra>
<extra name="rhsensor" type="attach_sensor">
<technique profile="OpenRAVE">
<instance_sensor url="#sensor6"/>
<frame_origin link="kmodel1/link9">
<translate>0 0 0</translate>
<rotate>0.57737 0.57735 0.57735 2.0944</rotate>
</frame_origin>
</technique>
</extra>
<extra name="WAIST" type="attach_actuator">
<technique profile="OpenRAVE">
<instance_actuator url="#actuator1"/>
Expand Down Expand Up @@ -8725,6 +8743,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<image_dimensions>640 480 3</image_dimensions>
<measurement_time>0.033333</measurement_time>
</sensor>
<sensor id="sensor5" sid="0" type="base_force6d">
<load_range_force>-1.000000 -1.000000 -1.000000</load_range_force>
<load_range_torque>-1.000000 -1.000000 -1.000000</load_range_torque>
</sensor>
<sensor id="sensor6" sid="1" type="base_force6d">
<load_range_force>-1.000000 -1.000000 -1.000000</load_range_force>
<load_range_torque>-1.000000 -1.000000 -1.000000</load_range_torque>
</sensor>
</technique>
</extra>
<extra id="actuators" type="library_actuators">
Expand Down
13 changes: 13 additions & 0 deletions nextage_description/models/main.wrl
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,13 @@ DEF HiroNX Humanoid{
mass 1.05156
momentsOfInertia [ 0.00194072 -1.1E-7 -4.2482E-4 -1.1E-7 0.00209392 -1.2E-7 -4.2482E-4 -1.2E-7 3.5788E-4 ]
children [
DEF rhsensor ForceSensor {
# translation 0 0 0
translation -0.035 0 0
# rotation 0.57737 0.57735 0.57735 2.0944
rotation 0 1 0 -1.570796327
sensorId 0
}
Transform {
translation -0.0061 0.0 -0.002
children Shape {
Expand Down Expand Up @@ -765,6 +772,12 @@ DEF HiroNX Humanoid{
mass 1.05156
momentsOfInertia [ 0.00194072 1.1E-7 -4.2482E-4 1.1E-7 0.00209392 1.2E-7 -4.2482E-4 1.2E-7 3.5788E-4 ]
children[
DEF lhsensor ForceSensor {
translation -0.035 0 0
# rotation 0.57737 0.57735 0.57735 2.0944
rotation 0 1 0 -1.570796327
sensorId 1
}
Transform {
#translation -0.0225 0.010 -0.0301
translation -0.0061 0.0 -0.002
Expand Down
2 changes: 2 additions & 0 deletions nextage_ros_bridge/conf/nextage.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<property name="outport" value="CAMERA_HEAD_L:CAMERA_HEAD_L:VISION_SENSOR"/>
<property name="outport" value="CAMERA_HAND_R:CAMERA_HAND_R:VISION_SENSOR"/>
<property name="outport" value="CAMERA_HAND_L:CAMERA_HAND_L:VISION_SENSOR"/>
<property name="outport" value="lhsensor:lhsensor:FORCE_SENSOR"/>
<property name="outport" value="rhsensor:rhsensor:FORCE_SENSOR"/>
<property name="WAIST.NumOfAABB" value="1"/>
<property name="WAIST.translation" value="0 0 0"/>
<property name="WAIST.rotation" value="1 0 0 0"/>
Expand Down
2 changes: 2 additions & 0 deletions nextage_ros_bridge/conf/nextage_nosim.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
<property name="outport" value="CAMERA_HEAD_L:CAMERA_HEAD_L:VISION_SENSOR"/>
<property name="outport" value="CAMERA_HAND_R:CAMERA_HAND_R:VISION_SENSOR"/>
<property name="outport" value="CAMERA_HAND_L:CAMERA_HAND_L:VISION_SENSOR"/>
<property name="outport" value="lhsensor:lhsensor:FORCE_SENSOR"/>
<property name="outport" value="rhsensor:rhsensor:FORCE_SENSOR"/>
<property name="WAIST.NumOfAABB" value="1"/>
<property name="WAIST.translation" value="0 0 0"/>
<property name="WAIST.rotation" value="1 0 0 0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<arg name="nameserver" value="$(arg NAMESERVER)" />
<arg name="MODEL_FILE" value="$(arg MODEL_FILE)" />
<arg name="SIMULATOR_NAME" value="HiroNX(Robot)0" />
<arg name="USE_IMPEDANCECONTROLLER" default="true"/>
<arg name="CONF_FILE_COLLISIONDETECT" value="$(arg CONF_FILE_COLLISIONDETECT)" />
</include>

Expand Down
39 changes: 39 additions & 0 deletions nextage_ros_bridge/test/test_hironx_derivedmethods_rostest.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,45 @@ def test_getJointAngles(self):
self.assertEqual(self._robot.InitialPose[3][5],
joint_angles[_JOINT_TESTED[0]])

def test_impedance_controller(self):
'''
Copied from hironx_ros_bridge/test/test_hironx_controller.py
'''
KINGROUP = 'rarm'
if not self._robot.ic or self._robot.ic.ref.get_component_profile().version < '315.3.0':
self.assertTrue(True)
return True
self._robot.goInitial(tm=1)
# this returns ret, this is a bug
ret = self._robot.startImpedance(KINGROUP)
#self.assertTrue(ret)
ret = self._robot.seq_svc.setWrenches([0, 0, 0, 0, 0, 0,
10, 0, 0, 0, 0, 0], 2.0)
#self.assertTrue(ret)
self._robot.seq_svc.waitInterpolation()
ret = self._robot.seq_svc.setWrenches([0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0], 2.0)
#self.assertTrue(ret)
self._robot.seq_svc.waitInterpolation()
ret = self._robot.seq_svc.setWrenches([0, 0, 0, 0, 0, 0,
0, 10, 0, 0, 0, 0], 2.0)
#self.assertTrue(ret)
self._robot.seq_svc.waitInterpolation()
ret = self._robot.seq_svc.setWrenches([0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0], 2.0)
#self.assertTrue(ret)
self._robot.seq_svc.waitInterpolation()
ret = self._robot.seq_svc.setWrenches([0, 0, 0, 0, 0, 0,
0, 0, 10, 0, 0, 0], 2.0)
#self.assertTrue(ret)
self._robot.seq_svc.waitInterpolation()
#self.assertTrue(ret)
ret = self._robot.stopImpedance(KINGROUP)
#self.assertTrue(ret)
# this is dummy, current simulate hiro does not have force sensor
# so it retunrs None
self.assertTrue(True)

if __name__ == '__main__':
import rostest
rostest.rosrun(_PKG, 'test_hironx_derivedmethods',
Expand Down