Skip to content

Commit

Permalink
Merge pull request #6706 from cyberbotics/sync-master-1ad0a694f
Browse files Browse the repository at this point in the history
Merge master into develop
omichel authored Nov 24, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents bdba49c + 4334bda commit 37f0c14
Showing 16 changed files with 541 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright 1996-2023 Cyberbotics Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from controller import Robot, Keyboard

# Create the Robot instance.
robot = Robot()

keyboard = Keyboard()
keyboard.enable(1000)

# Get the time step of the current world.
timestep = int(robot.getBasicTimeStep())

# Get left and right motors.
left_motor = robot.getDevice('left_motor')
right_motor = robot.getDevice('right_motor')

# Enable position control mode for motors.
left_motor.setPosition(float('inf'))
right_motor.setPosition(float('inf'))

# Set initial velocities.
left_velocity = 0.0
right_velocity = 0.0

# Main loop:
# - perform simulation steps until Webots is stopping the controller
while robot.step(timestep) != -1:
# Read keyboard input.
key = keyboard.getKey()
# Process keyboard input.
if key == ord('W') or key == ord('w'):
left_velocity = 5.0
right_velocity = 5.0
elif key == ord('S') or key == ord('s'):
left_velocity = -5.0
right_velocity = -5.0
elif key == ord('A') or key == ord('a'):
left_velocity = -2.5
right_velocity = 2.5
elif key == ord('D') or key == ord('d'):
left_velocity = 2.5
right_velocity = -2.5
else:
left_velocity = 0.0
right_velocity = 0.0
# Set motor velocities.
left_motor.setVelocity(left_velocity)
right_motor.setVelocity(right_velocity)
182 changes: 182 additions & 0 deletions projects/robots/clearpath/heron/protos/Heron.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
#VRML_SIM R2024a utf8
# license: Copyright Cyberbotics Ltd. Licensed for use only with Webots.
# license url: https://cyberbotics.com/webots_assets_license
# documentation url: https://webots.cloud/run?url=https://github.com/cyberbotics/webots/blob/released/projects/robots/clearpath/heron/protos/Heron.proto
# keywords: robot/wheeled
# Clearpath Heron USV is an autonomous watercraft designed for various marine tasks.
# It features electric propulsion, advanced navigation systems, and integration capabilities for collaborative missions.
# With a streamlined hull and multiple sensor suites including cameras,
# it excels in environmental monitoring, surveillance, and research.

PROTO Heron [
field SFVec3f translation 0 0 0.0 # Is `Pose.translation`.
field SFRotation rotation 0 0 1 0 # Is `Pose.rotation`.
field SFString name "heron" # Is `Solid.name`.
field SFString controller "heron_usv_controller" # Is `Robot.controller`.
field MFString controllerArgs [] # Is `Robot.controllerArgs`.
field SFString window "<generic>" # Is `Robot.window`.
field SFBool synchronization TRUE # Is `Robot.synchronization`.
field MFNode bodySlot [] # Extends the robot with new nodes in the body slot.
]
{
Robot {
translation IS translation
rotation IS rotation
name IS name
model "Clearpath Heron"
controller IS controller
controllerArgs IS controllerArgs
window IS window
synchronization IS synchronization
children [
DEF BODY_SLOT Group {
children IS bodySlot
}
Transform {
translation -0.185 0 0
rotation 0 0 1 1.01503e-06
children [
Shape {
appearance PBRAppearance {
baseColor 0.964706 0.827451 0.176471
metalness 0
}
geometry Mesh {
url [
"../stl/plain-rear-plate.stl"
]
}
}
]
}
Transform {
translation 0 -0.35 0.05
children [
Shape {
appearance PBRAppearance {
baseColor 0.960784 0.760784 0.0666667
metalness 0
}
geometry Mesh {
url [
"../stl/right_panel.stl"
]
}
}
]
}
Transform {
translation 0 0.35 0.05
children [
Shape {
appearance PBRAppearance {
baseColor 0.960784 0.760784 0.0666667
metalness 0
}
geometry Mesh {
url [
"../stl/left_panel.stl"
]
}
}
]
}
Transform {
translation -0.73 0.38 -0.14
children [
Propeller {
device RotationalMotor {
name "left_motor"
maxVelocity 30
}
fastHelix Solid {
rotation 0 1 0 1.57
children [
Shape {
appearance PBRAppearance {
baseColor 0.368627 0.360784 0.392157
}
geometry Cylinder {
height 0.1
radius 0.05
}
}
]
}
}
]
}
Transform {
translation -0.73 -0.38 -0.14
children [
Propeller {
device RotationalMotor {
name "right_motor"
maxVelocity 30
}
fastHelix Solid {
rotation 0 1 0 1.5708
children [
Shape {
appearance PBRAppearance {
baseColor 0.368627 0.360784 0.392157
}
geometry Cylinder {
height 0.1
radius 0.05
}
}
]
}
}
]
}
DEF HERON Shape {
appearance Appearance {
material Material {
diffuseColor 0.239216 0.219608 0.27451
}
texture ImageTexture {
}
textureTransform TextureTransform {
}
}
geometry Mesh {
url [
"../stl/heron_base.stl"
]
}
}
]
name "heron_usv"
immersionProperties [
ImmersionProperties {
fluidName "fluid"
dragForceCoefficients 0.01 0 0
dragTorqueCoefficients 0.05 0 0
viscousResistanceForceCoefficient 400
viscousResistanceTorqueCoefficient 0.1
}
]
boundingObject Transform {
scale 0.1 0.1 0.1
children [
Mesh {
url [
"../stl/heron_collision.stl"
]
}
]
}
physics Physics {
density 400
centerOfMass [
0 0 0
]
damping Damping {
linear 0.5
angular 0.5
}
}
}
}
44 changes: 44 additions & 0 deletions projects/robots/clearpath/heron/protos/docs/heron.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
The [clearpath's Heron USV](https://robots.ros.org/clearpath-heron-usv/) is a USV platform.

### Motors

There are 2 motor, motor name `left_motor`and `right_motor`.
You can add new Camera, GPS or other sensors you want under `body_slot`.

### Movie Presentation

![youtube video](https://www.youtube.com/watch?v=qWRyCnJWVuM)

### Heron PROTO

Derived from [Robot](https://cyberbotics.com/doc/reference/robot).

```js
Heron {
SFVec3f translation 0 0 0
SFRotation rotation 0 1 0 1.5708
SFString name "heron"
SFString controller "heron_usv_controller"
MFString controllerArgs []
SFBool synchronization TRUE
MFNode bodySlot []
}
```

#### Heron Field Summary

- `bodySlot`: Extends the robot with new nodes.

### Samples

You will find the following sample in this folder: "[WEBOTS\_HOME/projects/robots/clearpath/heron/worlds]({{ url.github_tree }}/projects/robots/clearpath/heron/worlds)".

Ocean

#### [heron\ocean.wbt]({{ url.github_tree }}/projects/robots/clearpath/heron/worlds/ocean.wbt)

![ocean.png](images/heron/ocean.jpg) This simulation shows a basicly usv.

#### [heron\swarm.wbt]({{ url.github_tree }}/projects/robots/clearpath/heron/worlds/swarm.wbt)

![swarm.png](images/heron/swarm.jpg) This simulation shows a basicly swarm robotics.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions projects/robots/clearpath/heron/webots.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
publish: true
9 changes: 9 additions & 0 deletions projects/robots/clearpath/heron/worlds/.ocean.wbproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Webots Project File version R2024a
perspectives: 000000ff00000000fd00000002000000010000011c00000313fc0200000001fb0000001400540065007800740045006400690074006f00720100000016000003130000004100ffffff0000000300000780000000d9fc0100000001fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000000007800000006900ffffff000006620000031300000001000000020000000100000008fc00000000
simulationViewPerspectives: 000000ff000000010000000200000100000005620100000002010000000100
sceneTreePerspectives: 000000ff000000010000000300000201000000d6000000000100000002010000000200
maximizedDockId: -1
centralWidgetVisible: 1
orthographicViewHeight: 1
textFiles: -1
consoles: Console:All:All
9 changes: 9 additions & 0 deletions projects/robots/clearpath/heron/worlds/.swarm.wbproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Webots Project File version R2024a
perspectives: 000000ff00000000fd00000002000000010000011c000002f1fc0200000001fb0000001400540065007800740045006400690074006f00720100000016000002f10000003f00ffffff0000000300000780000000d9fc0100000001fb0000001a0043006f006e0073006f006c00650041006c006c0041006c006c0100000000000007800000006900ffffff00000662000002f100000001000000020000000100000008fc00000000
simulationViewPerspectives: 000000ff000000010000000200000100000005620100000002010000000100
sceneTreePerspectives: 000000ff00000001000000030000001c000002b4000000fa0100000002010000000200
maximizedDockId: -1
centralWidgetVisible: 1
orthographicViewHeight: 1
textFiles: -1
consoles: Console:All:All
110 changes: 110 additions & 0 deletions projects/robots/clearpath/heron/worlds/ocean.wbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#VRML_SIM R2024a utf8

EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2024a/projects/objects/backgrounds/protos/TexturedBackground.proto"
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2024a/projects/objects/backgrounds/protos/TexturedBackgroundLight.proto"
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2024a/projects/objects/obstacles/protos/OilBarrel.proto"
EXTERNPROTO "../protos/Heron.proto"

WorldInfo {
}
Viewpoint {
orientation -0.24219658556528326 0.039505018164956274 0.9694225948884753 2.986262471610857
position 6.727587480647112 -2.788009572581076 8.707663910740424
}
TexturedBackground {
}
TexturedBackgroundLight {
}
DEF WATER Fluid {
children [
Shape {
appearance PBRAppearance {
baseColor 0.0626841 0.552224 0.723339
transparency 0.7
roughness 1
metalness 0
}
geometry DEF WATER_BOX Box {
size 1000 1000 0.7
}
}
]
viscosity 0.01
boundingObject Transform {
children [
USE WATER_BOX
]
}
locked TRUE
}
Heron {
translation -6.6784157308512615 -0.49028637658352825 0.46070759689397855
rotation 0.0001714429217129001 0.0006475645044607216 -0.9999997756337433 0.5176249841363672
}
OilBarrel {
translation -5.769041604986175 5.7137363726152754 0.5595498936504114
rotation -0.17000006110990545 -0.9047921649529347 0.3904498911030834 1.7528146915175131
physics Physics {
density 100
damping Damping {
linear 0.5
angular 0.5
}
}
immersionProperties [
ImmersionProperties {
fluidName "fluid"
}
]
}
OilBarrel {
translation -10.052079249302796 2.4814946123187727 0.5595498875102384
rotation -0.2751145870612611 -0.6601107052655576 0.6989748355841717 -2.8437234726044736
name "oil barrel(1)"
physics Physics {
density 100
damping Damping {
linear 0.5
angular 0.5
}
}
immersionProperties [
ImmersionProperties {
fluidName "fluid"
}
]
}
OilBarrel {
translation -9.806804324970415 -3.2705951440882433 0.5595498919704249
rotation 0.9914248557443196 0.04559709558681102 0.12246493492588871 1.5859460279251565
name "oil barrel(2)"
physics Physics {
density 100
damping Damping {
linear 0.5
angular 0.5
}
}
immersionProperties [
ImmersionProperties {
fluidName "fluid"
}
]
}
OilBarrel {
translation -9.046348837161165 3.2463636605243056 0.5595498964941401
rotation 0.737839555282382 0.14393292832237511 -0.6594513650036995 -2.4506597166551938
name "oil barrel(3)"
physics Physics {
density 100
damping Damping {
linear 0.5
angular 0.5
}
}
immersionProperties [
ImmersionProperties {
fluidName "fluid"
}
]
}
125 changes: 125 additions & 0 deletions projects/robots/clearpath/heron/worlds/swarm.wbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#VRML_SIM R2024a utf8

EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2024a/projects/objects/backgrounds/protos/TexturedBackground.proto"
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2024a/projects/objects/backgrounds/protos/TexturedBackgroundLight.proto"
EXTERNPROTO "https://raw.githubusercontent.com/cyberbotics/webots/R2024a/projects/objects/obstacles/protos/OilBarrel.proto"
EXTERNPROTO "../protos/Heron.proto"

WorldInfo {
}
Viewpoint {
orientation -0.18176804184458514 0.0956506889908684 0.978678356080054 2.3939203875238824
position 9.724896539150558 -16.953124456807643 11.603646524687557
}
TexturedBackground {
}
TexturedBackgroundLight {
}
DEF WATER Fluid {
children [
Shape {
appearance PBRAppearance {
baseColor 0.0626841 0.552224 0.723339
transparency 0.7
roughness 1
metalness 0
}
geometry DEF WATER_BOX Box {
size 1000 1000 0.7
}
}
]
viscosity 0.01
boundingObject Transform {
children [
USE WATER_BOX
]
}
locked TRUE
}
OilBarrel {
translation -5.769041604986175 5.7137363726152754 0.5595498919704249
rotation -0.16995723822816233 -0.9045642485178795 0.39099623716493703 1.751439322141487
physics Physics {
density 100
damping Damping {
linear 0.5
angular 0.5
}
}
immersionProperties [
ImmersionProperties {
fluidName "fluid"
}
]
}
OilBarrel {
translation -10.052079249302796 2.4814946123187727 0.5595498919704248
rotation -0.2750758106273439 -0.660017664982181 0.6990779501022608 -2.8436801772670055
name "oil barrel(1)"
physics Physics {
density 100
damping Damping {
linear 0.5
angular 0.5
}
}
immersionProperties [
ImmersionProperties {
fluidName "fluid"
}
]
}
OilBarrel {
translation -9.806804324970415 -3.2705951440882433 0.5595498919704248
rotation 0.9914248557443196 0.045597095586811014 0.12246493492588871 1.5859460279251565
name "oil barrel(2)"
physics Physics {
density 100
damping Damping {
linear 0.5
angular 0.5
}
}
immersionProperties [
ImmersionProperties {
fluidName "fluid"
}
]
}
OilBarrel {
translation -9.210530377900385 3.4633481997220334 0.5595498864740154
rotation 0.7706881417390529 0.22496315694279187 -0.5961806489656792 -2.154322256155228
name "oil barrel(3)"
physics Physics {
density 100
damping Damping {
linear 0.5
angular 0.5
}
}
immersionProperties [
ImmersionProperties {
fluidName "fluid"
}
]
}
Heron {
translation -6.615901389647778 -0.10311821791702494 0.4607076736909942
rotation -4.6247733909052664e-05 -0.002706298153373231 -0.9999963368990169 0.03417465445606993
}
Heron {
translation -6.52386 -1.44172 0.46070752315447433
rotation 0.00048045640364142506 0.030233731683355424 -0.9995427407720706 0.031794666209612875
name "heron(3)"
}
Heron {
translation -6.432764992739735 1.126054508316503 0.46070790263066325
rotation -2.9648308687466188e-05 -0.001213445947895377 -0.9999992633346834 0.04885661841190292
name "heron(1)"
}
Heron {
translation -6.32039 2.49159 0.4607075538980211
rotation -0.00040473384668264804 -0.029653153639982166 -0.9995601666081523 0.027308176523216297
name "heron(2)"
}

0 comments on commit 37f0c14

Please sign in to comment.