Commit e906477c authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Add files for webbots simulaiton. It is not working, see reachy_webots/README.md

parent 8b881bf2
Description de webots avec controller test en python ( my_controller ).
Des problèmes restent à résoudre
- La tête n'est pas reliée au corps
- Il n'y a pas de device caméra mais ça devrait être facile à ajouter.
- Les mouvements des moteurs sont étrangent. ( mauvaises, limites mauvaises unités d'angles, ... )
\ No newline at end of file
"""my_controller controller."""
# You may need to import some classes of the controller module. Ex:
# from controller import Robot, Motor, DistanceSensor
from controller import Robot
# create the Robot instance.
robot = Robot()
devices_nb=robot.getNumberOfDevices()
for i in range(devices_nb):
device=robot.getDeviceByIndex(i)
print(device.getName() + ':' + str(device.getNodeType()))
l_shoulder_pitch=robot.getDevice('l_shoulder_pitch')
l_shoulder_roll=robot.getDevice('l_shoulder_roll')
l_arm_yaw=robot.getDevice('l_arm_yaw')
r_shoulder_pitch=robot.getDevice('r_shoulder_pitch')
r_shoulder_roll=robot.getDevice('r_shoulder_roll')
r_arm_yaw=robot.getDevice('r_arm_yaw')
# get the time step of the current world.
timestep = int(robot.getBasicTimeStep())
# You should insert a getDevice-like function in order to get the
# instance of a device of the robot. Something like:
# motor = robot.getDevice('motorname')
# ds = robot.getDevice('dsname')
# ds.enable(timestep)
l_shoulder_roll.setVelocity(6)
print(l_shoulder_pitch.getVelocity())
print(l_shoulder_pitch.getMaxTorque())
# Main loop:
# - perform simulation steps until Webots is stopping the controller
while robot.step(timestep) != -1:
##print(r_shoulder_roll.getPosition())
l_shoulder_pitch.setPosition(1.57)
l_shoulder_roll.setPosition(1.57)
l_arm_yaw.setPosition(1.57)
r_shoulder_pitch.setPosition(1.57)
r_shoulder_roll.setPosition(1.57)
r_arm_yaw.setPosition(1.57)
# Read the sensors:
# Enter here functions to read sensor data, like:
# val = ds.getValue()
# Process sensor data here.
# Enter here functions to send actuator commands, like:
# motor.setPosition(10.0)
pass
# Enter here exit cleanup code.
Webots Proto Cache File version 1.5
protoFileHash: 4f848816f75d502892793111ddafb448
needsRobotAncestor: 1
baseType: Robot
slotType:
parameters: translation,rotation,name,controller,controllerArgs,customData,supervisor,synchronization,selfCollision
tags:
license: Apache License 2.0
licenseUrl: http://www.apache.org/licenses/LICENSE-2.0
documentationUrl:
info: This\sis\sa\sproto\sfile\sfor\sWebots\sfor\sthe\sReachy\nExtracted\sfrom:\sreachy_description/reachy.URDF\n
This diff is collapsed.
Webots Project File version R2021a
perspectives: 000000ff00000000fd00000003000000000000000000000000fc0100000001fb0000001a0044006f00630075006d0065006e0074006100740069006f006e0000000000ffffffff0000004e00ffffff000000010000024800000252fc0200000001fb0000001400540065007800740045006400690074006f00720100000000000002520000006d00ffffff00000003000005a0000000dcfc0100000001fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000000005a00000004e00ffffff000003520000025200000001000000020000000100000008fc00000000
simulationViewPerspectives: 000000ff000000010000000200000118000002340100000006010000000100
sceneTreePerspectives: 000000ff000000010000000200000112000000fc0100000006010000000200
maximizedDockId: -1
centralWidgetVisible: 1
orthographicViewHeight: 1
textFiles: 0 "controllers/my_controller/my_controller.py"
consoles: Console:All:All
#VRML_SIM R2021a utf8
WorldInfo {
coordinateSystem "NUE"
}
Viewpoint {
orientation -0.4551645604935758 0.8624753935633719 0.22127227202791802 0.9982962446877427
position 1.993866807122921 1.302543718875808 1.3714271771477162
}
TexturedBackground {
}
TexturedBackgroundLight {
}
Reachy {
hidden position_0_0 0.05122854599055362
hidden position_0_1 0.04923353073316836
hidden rotation_1 0 0.9999999999999999 0 0.05122854599055764
hidden position_1_0 0.15793017605308893
hidden rotation_2 1 0 0 0.15793017605308832
hidden position_2_0 -1.4915267444474548e-05
hidden rotation_3 0 0 -1 1.4915280805167573e-05
hidden position_3_0 8.179348118223976e-06
hidden rotation_4 0 1 0 8.179366690887821e-06
hidden position_4_0 -7.627610432137418e-06
hidden rotation_5 0 0 -1 7.627589880330957e-06
hidden position_5_0 2.801048347342763e-06
hidden rotation_6 0 1 0 2.8011012405181267e-06
hidden position_6_0 -1.253348404162176e-06
hidden rotation_7 -0.9999999999999999 0 0 1.253470232773628e-06
hidden position_7_0 4.3929291375630954e-08
hidden rotation_8 1 0 0 4.2146848510894035e-08
hidden rotation_10 0 0.9999999999999999 0 0.04923353073316711
hidden position_10_0 -2.2743133114281278e-05
hidden rotation_11 -1 0 0 2.2743136165515416e-05
hidden position_11_0 -2.1006596088327768e-05
hidden rotation_12 0 0 -1 2.100659984331945e-05
hidden position_12_0 -7.318149348117322e-06
hidden rotation_13 0 -1 0 7.318154299489585e-06
hidden position_13_0 2.12641987705387e-05
hidden rotation_14 0 0 1 2.1264202416339886e-05
hidden position_14_0 -3.215446266924194e-06
hidden rotation_15 0 -1 0 3.2154758564995297e-06
hidden position_15_0 5.168384118620038e-07
hidden rotation_16 1 0 0 5.170509687929607e-07
hidden position_16_0 4.429288605642696e-08
hidden rotation_17 1 0 0 4.2146848510894035e-08
hidden translation_22 -0.1560336487567941 0.3228493569020412 -0.8019839212558622
hidden rotation_22 -0.22373321806324561 0.7003637896467225 0.6778156159950476 -2.8624123175786957
hidden position_22_0 6.070634408912168e-16
hidden position_22_1 -5.321080535583234e-16
translation 0 0.75 0
rotation 1 0 0 -1.5671697220659069
controller "my_controller"
}
RectangleArena {
rotation 0 1 0 1.309
floorSize 10 10
}
SolidBox {
translation 0 0.25 0
size 0.2 0.5 0.2
appearance NULL
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment