Skip to content

Commit 37f0c14

Browse files
authored
Merge pull request #6706 from cyberbotics/sync-master-1ad0a694f
Merge master into develop
2 parents bdba49c + 4334bda commit 37f0c14

File tree

16 files changed

+541
-0
lines changed

16 files changed

+541
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Copyright 1996-2023 Cyberbotics Ltd.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from controller import Robot, Keyboard
16+
17+
# Create the Robot instance.
18+
robot = Robot()
19+
20+
keyboard = Keyboard()
21+
keyboard.enable(1000)
22+
23+
# Get the time step of the current world.
24+
timestep = int(robot.getBasicTimeStep())
25+
26+
# Get left and right motors.
27+
left_motor = robot.getDevice('left_motor')
28+
right_motor = robot.getDevice('right_motor')
29+
30+
# Enable position control mode for motors.
31+
left_motor.setPosition(float('inf'))
32+
right_motor.setPosition(float('inf'))
33+
34+
# Set initial velocities.
35+
left_velocity = 0.0
36+
right_velocity = 0.0
37+
38+
# Main loop:
39+
# - perform simulation steps until Webots is stopping the controller
40+
while robot.step(timestep) != -1:
41+
# Read keyboard input.
42+
key = keyboard.getKey()
43+
# Process keyboard input.
44+
if key == ord('W') or key == ord('w'):
45+
left_velocity = 5.0
46+
right_velocity = 5.0
47+
elif key == ord('S') or key == ord('s'):
48+
left_velocity = -5.0
49+
right_velocity = -5.0
50+
elif key == ord('A') or key == ord('a'):
51+
left_velocity = -2.5
52+
right_velocity = 2.5
53+
elif key == ord('D') or key == ord('d'):
54+
left_velocity = 2.5
55+
right_velocity = -2.5
56+
else:
57+
left_velocity = 0.0
58+
right_velocity = 0.0
59+
# Set motor velocities.
60+
left_motor.setVelocity(left_velocity)
61+
right_motor.setVelocity(right_velocity)
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
#VRML_SIM R2024a utf8
2+
# license: Copyright Cyberbotics Ltd. Licensed for use only with Webots.
3+
# license url: https://cyberbotics.com/webots_assets_license
4+
# documentation url: https://webots.cloud/run?url=https://github.com/cyberbotics/webots/blob/released/projects/robots/clearpath/heron/protos/Heron.proto
5+
# keywords: robot/wheeled
6+
# Clearpath Heron USV is an autonomous watercraft designed for various marine tasks.
7+
# It features electric propulsion, advanced navigation systems, and integration capabilities for collaborative missions.
8+
# With a streamlined hull and multiple sensor suites including cameras,
9+
# it excels in environmental monitoring, surveillance, and research.
10+
11+
PROTO Heron [
12+
field SFVec3f translation 0 0 0.0 # Is `Pose.translation`.
13+
field SFRotation rotation 0 0 1 0 # Is `Pose.rotation`.
14+
field SFString name "heron" # Is `Solid.name`.
15+
field SFString controller "heron_usv_controller" # Is `Robot.controller`.
16+
field MFString controllerArgs [] # Is `Robot.controllerArgs`.
17+
field SFString window "<generic>" # Is `Robot.window`.
18+
field SFBool synchronization TRUE # Is `Robot.synchronization`.
19+
field MFNode bodySlot [] # Extends the robot with new nodes in the body slot.
20+
]
21+
{
22+
Robot {
23+
translation IS translation
24+
rotation IS rotation
25+
name IS name
26+
model "Clearpath Heron"
27+
controller IS controller
28+
controllerArgs IS controllerArgs
29+
window IS window
30+
synchronization IS synchronization
31+
children [
32+
DEF BODY_SLOT Group {
33+
children IS bodySlot
34+
}
35+
Transform {
36+
translation -0.185 0 0
37+
rotation 0 0 1 1.01503e-06
38+
children [
39+
Shape {
40+
appearance PBRAppearance {
41+
baseColor 0.964706 0.827451 0.176471
42+
metalness 0
43+
}
44+
geometry Mesh {
45+
url [
46+
"../stl/plain-rear-plate.stl"
47+
]
48+
}
49+
}
50+
]
51+
}
52+
Transform {
53+
translation 0 -0.35 0.05
54+
children [
55+
Shape {
56+
appearance PBRAppearance {
57+
baseColor 0.960784 0.760784 0.0666667
58+
metalness 0
59+
}
60+
geometry Mesh {
61+
url [
62+
"../stl/right_panel.stl"
63+
]
64+
}
65+
}
66+
]
67+
}
68+
Transform {
69+
translation 0 0.35 0.05
70+
children [
71+
Shape {
72+
appearance PBRAppearance {
73+
baseColor 0.960784 0.760784 0.0666667
74+
metalness 0
75+
}
76+
geometry Mesh {
77+
url [
78+
"../stl/left_panel.stl"
79+
]
80+
}
81+
}
82+
]
83+
}
84+
Transform {
85+
translation -0.73 0.38 -0.14
86+
children [
87+
Propeller {
88+
device RotationalMotor {
89+
name "left_motor"
90+
maxVelocity 30
91+
}
92+
fastHelix Solid {
93+
rotation 0 1 0 1.57
94+
children [
95+
Shape {
96+
appearance PBRAppearance {
97+
baseColor 0.368627 0.360784 0.392157
98+
}
99+
geometry Cylinder {
100+
height 0.1
101+
radius 0.05
102+
}
103+
}
104+
]
105+
}
106+
}
107+
]
108+
}
109+
Transform {
110+
translation -0.73 -0.38 -0.14
111+
children [
112+
Propeller {
113+
device RotationalMotor {
114+
name "right_motor"
115+
maxVelocity 30
116+
}
117+
fastHelix Solid {
118+
rotation 0 1 0 1.5708
119+
children [
120+
Shape {
121+
appearance PBRAppearance {
122+
baseColor 0.368627 0.360784 0.392157
123+
}
124+
geometry Cylinder {
125+
height 0.1
126+
radius 0.05
127+
}
128+
}
129+
]
130+
}
131+
}
132+
]
133+
}
134+
DEF HERON Shape {
135+
appearance Appearance {
136+
material Material {
137+
diffuseColor 0.239216 0.219608 0.27451
138+
}
139+
texture ImageTexture {
140+
}
141+
textureTransform TextureTransform {
142+
}
143+
}
144+
geometry Mesh {
145+
url [
146+
"../stl/heron_base.stl"
147+
]
148+
}
149+
}
150+
]
151+
name "heron_usv"
152+
immersionProperties [
153+
ImmersionProperties {
154+
fluidName "fluid"
155+
dragForceCoefficients 0.01 0 0
156+
dragTorqueCoefficients 0.05 0 0
157+
viscousResistanceForceCoefficient 400
158+
viscousResistanceTorqueCoefficient 0.1
159+
}
160+
]
161+
boundingObject Transform {
162+
scale 0.1 0.1 0.1
163+
children [
164+
Mesh {
165+
url [
166+
"../stl/heron_collision.stl"
167+
]
168+
}
169+
]
170+
}
171+
physics Physics {
172+
density 400
173+
centerOfMass [
174+
0 0 0
175+
]
176+
damping Damping {
177+
linear 0.5
178+
angular 0.5
179+
}
180+
}
181+
}
182+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
The [clearpath's Heron USV](https://robots.ros.org/clearpath-heron-usv/) is a USV platform.
2+
3+
### Motors
4+
5+
There are 2 motor, motor name `left_motor`and `right_motor`.
6+
You can add new Camera, GPS or other sensors you want under `body_slot`.
7+
8+
### Movie Presentation
9+
10+
![youtube video](https://www.youtube.com/watch?v=qWRyCnJWVuM)
11+
12+
### Heron PROTO
13+
14+
Derived from [Robot](https://cyberbotics.com/doc/reference/robot).
15+
16+
```js
17+
Heron {
18+
SFVec3f translation 0 0 0
19+
SFRotation rotation 0 1 0 1.5708
20+
SFString name "heron"
21+
SFString controller "heron_usv_controller"
22+
MFString controllerArgs []
23+
SFBool synchronization TRUE
24+
MFNode bodySlot []
25+
}
26+
```
27+
28+
#### Heron Field Summary
29+
30+
- `bodySlot`: Extends the robot with new nodes.
31+
32+
### Samples
33+
34+
You will find the following sample in this folder: "[WEBOTS\_HOME/projects/robots/clearpath/heron/worlds]({{ url.github_tree }}/projects/robots/clearpath/heron/worlds)".
35+
36+
Ocean
37+
38+
#### [heron\ocean.wbt]({{ url.github_tree }}/projects/robots/clearpath/heron/worlds/ocean.wbt)
39+
40+
![ocean.png](images/heron/ocean.jpg) This simulation shows a basicly usv.
41+
42+
#### [heron\swarm.wbt]({{ url.github_tree }}/projects/robots/clearpath/heron/worlds/swarm.wbt)
43+
44+
![swarm.png](images/heron/swarm.jpg) This simulation shows a basicly swarm robotics.
9.22 KB
Loading
13.6 KB
Loading
4.17 KB
Loading
1.12 MB
Binary file not shown.
462 KB
Binary file not shown.
18.2 KB
Binary file not shown.
85.8 KB
Binary file not shown.

0 commit comments

Comments
 (0)