Skip to content
Snippets Groups Projects
Verified Commit 5964c99d authored by Trim Bresilla's avatar Trim Bresilla
Browse files

ADD: GPS-cordniates

parent fff7074e
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,9 @@ of the self-adaptive capabilities in their living environments. This behavior in
## ROBOT AND SENSORS
### Robot
### [Robot](https://cyberbotics.com/doc/guide/epuck)
E-puck is a miniature mobile robot originally developed at EPFL for teaching purposes by the designers of the successful Khepera robot. The hardware and software of e-puck is fully open source, providing low level access to every electronic device and offering unlimited extension possibilities.
......
......@@ -22,6 +22,15 @@ for i in range(8):
ps[i].enable(TIME_STEP)
ls[i].enable(TIME_STEP)
gps = robot.getDevice('gps')
gps.enable(TIME_STEP)
leftEncoder = robot.getDevice('left wheel sensor')
leftEncoder.enable(TIME_STEP)
rightEncoder = robot.getDevice('right wheel sensor')
rightEncoder.enable(TIME_STEP)
leftMotor = robot.getDevice('left wheel motor')
rightMotor = robot.getDevice('right wheel motor')
leftMotor.setPosition(float('inf'))
......@@ -35,6 +44,17 @@ while robot.step(TIME_STEP) != -1:
leftSpeed = 0.5 * MAX_SPEED
rightSpeed = 0.5 * MAX_SPEED
# read encoders
rightEncoderValue = rightEncoder.getValue()
leftEncoderValue = leftEncoder.getValue()
# read position
x = gps.getValues()[0]
y = gps.getValues()[1]
print("x: " + str(x))
print("y: " + str(y))
# read sensors outputs
psValues = []
lsValues = []
......@@ -45,9 +65,6 @@ while robot.step(TIME_STEP) != -1:
# detect light
left_light = np.mean([lsValues[5], lsValues[6], lsValues[7]])
right_light = np.mean([lsValues[0], lsValues[1], lsValues[2]])
print("LEFT LIGHT: " + str(left_light))
print("RIGHT LIGHT: " + str(right_light))
# detect obstacles
......
worlds/.world.jpg

27.8 KiB | W: | H:

worlds/.world.jpg

30.5 KiB | W: | H:

worlds/.world.jpg
worlds/.world.jpg
worlds/.world.jpg
worlds/.world.jpg
  • 2-up
  • Swipe
  • Onion skin
Webots Project File version R2022b
perspectives: 000000ff00000000fd0000000200000001000001c90000031cfc0200000001fb0000001400540065007800740045006400690074006f007201000000130000031c0000003f00ffffff0000000300000768000000d9fc0100000001fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000000007680000006900ffffff0000059d0000031c00000001000000020000000100000008fc00000000
perspectives: 000000ff00000000fd0000000200000001000001c90000082bfc0200000001fb0000001400540065007800740045006400690074006f007201000000130000082b0000003f00ffffff0000000300000d68000000d9fc0100000001fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c010000000000000d68000000000000000000000b9d0000082b00000001000000020000000100000008fc00000000
simulationViewPerspectives: 000000ff00000001000000020000014a0000061c0100000002010000000100
sceneTreePerspectives: 000000ff00000001000000030000001c000000c0000000fa0100000002010000000200
maximizedDockId: -1
centralWidgetVisible: 1
orthographicViewHeight: 1
textFiles: -1
consoles: Console:All:All
renderingDevicePerspectives: e-puck:camera;0;3.82051;0;0
renderingDevicePerspectives: e-puck:camera;0;3.21154;0;0
......@@ -7,16 +7,22 @@ EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2022b/project
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2022b/projects/objects/obstacles/protos/OilBarrel.proto"
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2022b/projects/appearances/protos/Parquetry.proto"
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2022b/projects/objects/factory/containers/protos/WoodenBox.proto"
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2022b/projects/robots/gctronic/e-puck/protos/E-puckGroundSensors.proto"
WorldInfo {
}
Viewpoint {
orientation -0.5773502691896258 0.5773502691896258 0.5773502691896258 2.0944
position 0.2886112430982633 0.30112288717536395 4.7561144404849145
orientation 0.5773502691896258 -0.5773502691896258 -0.5773502691896258 4.188785307179587
position -4.522005200556433e-06 -4.522017979724802e-06 3.499343674307644
}
TexturedBackground {
}
TexturedBackgroundLight {
luminosity 0.1
}
PointLight {
attenuation 0 0 1
intensity 2
}
RectangleArena {
floorSize 2 2
......@@ -25,19 +31,17 @@ RectangleArena {
}
}
E-puck {
hidden position_0_0 28.033302105971305
hidden position_0_1 27.431657135094095
hidden linearVelocity_0 -0.01040089258177146 0.0005189791645317463 -0.00010164286476468898
hidden angularVelocity_0 -0.012580145309195254 -0.6870843501448997 -2.2292946089286447
hidden rotation_1 0 -1 0 6.162461784455415
hidden linearVelocity_1 0.043782987222245516 -0.0016398885897364905 -2.215561220686446e-05
hidden angularVelocity_1 0.09747530080179415 2.4512349752960945 -2.23409528946547
hidden rotation_2 0 1 0 6.147970605148766
hidden linearVelocity_2 -0.07125569725759662 0.002336362298856977 -3.4872247586914343e-06
hidden angularVelocity_2 -0.12270046057049977 -3.8254049928433136 -2.2324546810944326
translation 0.6222753536792252 0.3401916142101004 -6.850241694632969e-05
rotation 0.004217783566957383 -0.029762230724924357 -0.9995481078587757 0.09378488003841622
translation -0.86 0 -0.000294454
rotation -0.00017413628648491703 -0.0003860082047833772 -0.9999999103371058 0
controller "my_controller"
turretSlot [
GPS {
}
]
groundSensorsSlot [
E-puckGroundSensors {
}
]
}
OilBarrel {
translation 0 -0.34 0.11
......@@ -74,10 +78,10 @@ WoodenBox {
size 0.2 0.2 0.2
}
WoodenBox {
translation -0.619472 -0.0550393 0.11
translation -0.632412 -0.00674303 0.11
rotation 0 0 -1 -0.261795307179586
name "wooden box(3)"
size 0.2 0.2 0.2
size 0.2 0.4 0.2
}
WoodenBox {
translation -0.449264 -0.608328 0.11
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment