Skip to content

Commit

Permalink
Merge develop in feature-web-proto (#5693)
Browse files Browse the repository at this point in the history
* Fix infinite dictionary update (#5676)

* Port changes to master branch

* Check if field triggers regeneration before using it after changing the value

* Fix brackets

* Update changelog

* Disable Select button in WbExtendedStringEditor for restricted fields (#5663)

* Update WbExtendedStringEditor.hpp

* Disable select button for restricted fields

* Update changelog-r2023.md

* Fix wrong assertion failure for console redirection (#5671)

* Add null if nothing was read

* Update src/controller/c/robot.c

Co-authored-by: Olivier Michel <[email protected]>

Co-authored-by: Olivier Michel <[email protected]>

* Improve automobile documentation (#5653)

* Add vehicles documentation

* Improve PROTO descriptions and fix default translations

* update icon_creator

* Update images

* Update generated sources

* Update model image

* Add image thumbnails

* Reuse script for generating vehicles doc

* Reuse script for generating vehicles doc

* Fix image path

* Update car.md

* Fix anchors

* Update vehicle-citroen.md

* Update vehicle-lincoln.md

* Update vehicle-range-rover.md

* Update vehicle-tesla.md

* Update vehicle-toyota.md

* Update ToyotaPrius.proto

* Update vehicle-toyota.md

* Update car.md

* Update vehicle-generic.md

* Update BusWheel.proto

* Update vehicle-bmw.md

* Update vehicle-citroen.md

* Update vehicle-toyota.md

* Update BmwX5Wheel.proto

* Update CitroenCZeroFrontWheel.proto

* Update CitroenCZeroRearWheel.proto

* Update ToyotaPrius.proto

* Fix documentation generated from PROTO files

* Fix pep8 error

* Update car.md

* Add car PROTO field descriptions

* Add description to generic vehicle fields

* Regenerate documentation

* Remove duplicated util file

* Add entry in Changelog

* Improve robustness to NaN values in robot window plots (#5680)

* Ignore NaN values when adjusting the plot range

* Add ChangeLog entry

* Better working directory on Windows (#5685)

Co-authored-by: Stefania Pedrazzi <[email protected]>
Co-authored-by: Yannick Goumaz <[email protected]>
Co-authored-by: Olivier Michel <[email protected]>
  • Loading branch information
4 people authored Dec 23, 2022
1 parent c9e3af4 commit 992c706
Show file tree
Hide file tree
Showing 151 changed files with 2,873 additions and 832 deletions.
41 changes: 27 additions & 14 deletions docs/automobile/car.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Car {
MFFloat gearRatio [-12 10 7 5 2.5 1]
SFFloat hybridPowerSplitRatio 0.25
SFFloat hybridPowerSplitRPM 3000
SFString window "automobile"
SFString window "automobile"
}
```

Expand Down Expand Up @@ -107,19 +107,20 @@ For the three other sensor slots, the positions are different for each model (be

| Model | Front slot translation | Top slot translation | Rear slot translation |
| -------------------- | ---------------------- | -------------------- | --------------------- |
| BmwX5 | 3.85 0 0.45 | 1 0 1.45 | -1 0 0.3 |
| LincolnMKZ | 3.944 0 0.142 | 1.11 0 1.16 | -1.06 0 0.33 |
| RangeRoverSportSVR | 3.5 0 0.5 | 1.4 0 1.3 | -1.06 0 0.33 |
| CitroenCZero | 3.075 0 0.05 | 1.075 0 1.35 | -0.425 0 0.3 |
| ToyotaPrius | 3.635 0 0.4 | 1.1 0 1.3 | -0.85 0 0.3 |
| TeslaModel3 | 3.79 0 0.142 | 1.11 0 1.16 | -1.05 0 0.2 |
| MercedesBenzSprinter | 5.31 0 0.47 | 2.99 0 2.3 | 0 0 1 3.1415 |
| [BmwX5](vehicle-bmw.md#bmwx5) | 3.85 0 0.45 | 1 0 1.45 | -1 0 0.3 |
| [LincolnMKZ](vehicle-lincoln.md#lincolnmkz) | 3.944 0 0.142 | 1.11 0 1.16 | -1.06 0 0.33 |
| [RangeRoverSportSVR](vehicle-range-rover.md#rangeroversportsvr) | 3.5 0 0.5 | 1.4 0 1.3 | -1.06 0 0.33 |
| [CitroenCZero](vehicle-citroen.md#citroenczero) | 3.075 0 0.05 | 1.075 0 1.35 | -0.425 0 0.3 |
| [ToyotaPrius](vehicle-toyota.md#toyotaprius) | 3.635 0 0.4 | 1.1 0 1.3 | -0.85 0 0.3 |
| [TeslaModel3](vehicle-tesla.md#teslamodel3) | 3.79 0 0.142 | 1.11 0 1.16 | -1.05 0 0.2 |
| [MercedesBenzSprinter](vehicle-mercedes-benz.md#mercedesbenzsprinter) | 5.31 0 0.47 | 2.99 0 2.3 | 0 0 1 3.1415 |


%end

### Heavy-Weights

Just like the car models presented above, two generic heavy-weights PROTO inherit from the `Car` PROTO: a bus and a truck.
Just like the car models presented above, two generic heavy-weights PROTO models inherit from the `Car` PROTO: a bus and a truck.
In the case of the truck, a trailer can be present or not.
The latter is the `endPoint` of a [HingeJoint](../reference/hingejoint.md) allowing the trailer to freely rotate around its attachment point.
There are currently two trailers to be used: a regular one and a tank shaped model.
Expand All @@ -138,11 +139,23 @@ The rest of the positions can be seen in the [following table](#positions-of-the

| Model | Front slot translation | Top slot translation | Rear slot translation |
| ------- | ---------------------- | -------------------- | --------------------- |
| Bus | 11.5 0 0.2 | 2.5 0 5.3 | -6.2 0 1 |
| Truck | 6.75 0 1.1 | 4.3 0 4.15 | -7.3 0 2.7 |
| [Bus](vehicle-generic.md#bus) | 11.5 0 0.2 | 2.5 0 5.3 | -6.2 0 1 |
| [Truck](vehicle-generic.md#truck)| 6.75 0 1.1 | 4.3 0 4.15 | -7.3 0 2.7 |

%end

### Agricultural Vehicles

A [Tractor](vehicle-generic.md#tractor) PROTO model is also provided which inherits from the `Car` PROTO.

%figure "Model of a Tractor using the `Car` PROTO"

![Tractor.png](images/generic/Tractor.thumbnail.png)

%end

The [Tractor](vehicle-generic.md#tractor) PROTO model provides a `sensorSlot` at center of the vehicle.

### Simple Vehicles

In addition to the controllable models of vehicle, several kinematic vehicles (called 'simple') are available.
Expand Down Expand Up @@ -197,8 +210,8 @@ The different simple versions of the car PROTO nodes represent the different mod

#### TwoWheelerSimple

Due to the presence of driver, the TwoWheelerSimple PROTO nodes have a slightly different organization.
Similar to CarSimple, the TwoWheelerSimple PROTO displayed bellow is just a common structure for the different versions of the two wheelers.
Due to the presence of driver, the TwoWheelerSimple PROTO node have a slightly different organization.
Similar to CarSimple, the TwoWheelerSimple PROTO displayed below is just a common structure for the different versions of the two wheelers.

```
PROTO TwoWheelerSimple {
Expand All @@ -218,7 +231,7 @@ PROTO TwoWheelerSimple {
- `secondaryColor`: Defines a secondary color to be chosen alongside the main one.
- `driver`: Defines a `Slot` node for the two-wheeler driver.

ScooterSimple and MotorbikeSimple are examples of actual TwoWheelerSimple PROTO that represent a scooter and a motorbike:
[ScooterSimple](vehicle-generic.md#scootersimple) and [MotorbikeSimple](vehicle-generic.md#motorbikesimple) are examples of actual TwoWheelerSimple PROTO that represent a scooter and a motorbike:

%figure "Models of ScooterSimple and MotorbikeSimple currently available"

Expand Down
81 changes: 81 additions & 0 deletions docs/automobile/generate_vehicles_doc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# 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
#
# http://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.

import os
from io import open
import sys
sys.path.append('../')
from generate_doc_util import get_proto_files_in_directory, generate_doc_for_proto_files # noqa: E402


def get_category(proto_file):
category = os.path.basename(os.path.dirname(proto_file))
return category, 'vehicles'


# look for all the PROTO files
vehiclesDir = os.path.join(os.environ['WEBOTS_HOME'], 'projects', 'vehicles', 'protos')
carsDirNames = ['bmw', 'citroen', 'lincoln', 'mercedes_benz', 'range_rover', 'tesla', 'toyota', 'generic']
fileList = []
for dirName in carsDirNames:
fileList += get_proto_files_in_directory(os.path.join(vehiclesDir, dirName))
fileList = sorted(fileList)

# make sure that if a PROTO has the same name than the title it appears first
prioritaryProtoList = []
for proto in fileList:
protoName = os.path.basename(proto).split('.')[0]
categoryName = os.path.basename(os.path.dirname(os.path.dirname(proto)))
upperCategoryName = os.path.basename(os.path.dirname(os.path.dirname(os.path.dirname(proto))))
if protoName.lower() == categoryName and upperCategoryName == 'objects':
prioritaryProtoList.append(proto)
fileList.remove(proto)

upperCategories = generate_doc_for_proto_files(
prioritaryProtoList + fileList,
{},
'vehicle-',
get_category
)

# write the menu in 'object.md'
upperCategoriesList = sorted(upperCategories.keys())
categoriesList = []
with open('proto-nodes.md', 'w', encoding='utf-8', newline='\n') as file:
file.write(u'# PROTO Nodes\n\n')
file.write(u'This section presents the set of PROTO nodes developed specifically for automobile related simulations, ' +
'from the PROTO of a wheel to the PROTO of a complete car.\n\n')
file.write(u'## Sections\n\n')
file.write(u'- [AckermannVehicle](ackermannvehicle.md)\n')
file.write(u'- [VehicleWheel](vehiclewheel.md)\n')
file.write(u'- [Car](car.md)\n')
for upperCategory in upperCategoriesList:
categories = sorted(upperCategories[upperCategory])
for category in categories:
categoriesList.append(category)
file.write(u'- [%s](vehicle-%s.md)\n' % (category.replace('_', ' ').title(), category.replace('_', '-')))
file.write(u'\n')

# print the updated part of 'menu.md'
categoriesList = sorted(categoriesList)
print("Please update the 'PROTO Nodes' part in 'menu.md' with:")
print(' - [AckermannVehicle](ackermannvehicle.md)')
print(' - [VehicleWheel](vehiclewheel.md)')
print(' - [Car](car.md)')
print(' - [Car](car.md)')
for category in categoriesList:
print(' - [%s](vehicle-%s.md)' % (category.replace('_', ' ').title(), category.replace('_', '-')))
Binary file removed docs/automobile/images/BmwX5Wheel.png
Binary file not shown.
Binary file added docs/automobile/images/bmw/BmwX5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/automobile/images/bmw/BmwX5.thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/automobile/images/bmw/BmwX5Simple.png
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 added docs/automobile/images/bmw/BmwX5Wheel.png
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 added docs/automobile/images/citroen/CitroenCZero.png
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.
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.
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 added docs/automobile/images/generic/Bus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/automobile/images/generic/Bus.thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/automobile/images/generic/BusSimple.png
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 added docs/automobile/images/generic/BusWheel.png
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.
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 added docs/automobile/images/generic/ScooterDriver.png
Binary file added docs/automobile/images/generic/ScooterSimple.png
Binary file added docs/automobile/images/generic/ScooterWheel.png
Binary file added docs/automobile/images/generic/Tractor.png
Binary file added docs/automobile/images/generic/Truck.png
Binary file added docs/automobile/images/generic/TruckSimple.png
Binary file added docs/automobile/images/generic/TruckTank.png
Binary file added docs/automobile/images/generic/TruckTrailer.png
Binary file added docs/automobile/images/generic/TruckWheel.png
Binary file added docs/automobile/images/lincoln/LincolnMKZ.png
Binary file added docs/automobile/images/tesla/TeslaModel3.png
Binary file added docs/automobile/images/toyota/ToyotaPrius.png
10 changes: 9 additions & 1 deletion docs/automobile/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

- [Introduction](introduction.md)
- [PROTO Nodes](proto-nodes.md)
- [VehicleWheel](vehiclewheel.md)
- [AckermannVehicle](ackermannvehicle.md)
- [VehicleWheel](vehiclewheel.md)
- [Car](car.md)
- [Bmw](vehicle-bmw.md)
- [Citroen](vehicle-citroen.md)
- [Generic](vehicle-generic.md)
- [Lincoln](vehicle-lincoln.md)
- [Mercedes Benz](vehicle-mercedes-benz.md)
- [Range Rover](vehicle-range-rover.md)
- [Tesla](vehicle-tesla.md)
- [Toyota](vehicle-toyota.md)
- [Car and Driver Libraries](car-and-driver-libraries.md)
- [Driver Library](driver-library.md)
- [Car Library](car-library.md)
Expand Down
11 changes: 10 additions & 1 deletion docs/automobile/proto-nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ This section presents the set of PROTO nodes developed specifically for automobi

## Sections

- [VehicleWheel](vehiclewheel.md)
- [AckermannVehicle](ackermannvehicle.md)
- [VehicleWheel](vehiclewheel.md)
- [Car](car.md)
- [Bmw](vehicle-bmw.md)
- [Citroen](vehicle-citroen.md)
- [Generic](vehicle-generic.md)
- [Lincoln](vehicle-lincoln.md)
- [Mercedes Benz](vehicle-mercedes-benz.md)
- [Range Rover](vehicle-range-rover.md)
- [Tesla](vehicle-tesla.md)
- [Toyota](vehicle-toyota.md)

175 changes: 175 additions & 0 deletions docs/automobile/vehicle-bmw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# Bmw

## BmwX5

Model of an BMW X5 car using the [Car](car.md) PROTO as a base.
The vehicle is modelled with realistic physics properties: motor torques, body mass, friction forces, suspensions, etc.
This model was sponsored by the CTI project RO2IVSim ([http://transport.epfl.ch/simulator-for-mobile-robots-and-intelligent-vehicles](http://transport.epfl.ch/simulator-for-mobile-robots-and-intelligent-vehicles)).
For the last 6 fields to have any effect, the 'interior' has to be enabled.

%figure

![BmwX5](images/bmw/BmwX5.thumbnail.png)

%end

Derived from [Robot](../reference/robot.md).

```
BmwX5 {
SFVec3f translation 0 0 0.4
SFRotation rotation 0 0 1 0
SFColor color 0.43 0.11 0.1
SFString engineSound "sounds/engine.wav"
SFString name "vehicle"
SFString controller "<generic>"
MFString controllerArgs []
SFBool supervisor FALSE
SFBool synchronization TRUE
SFBool windshieldWipers TRUE
SFBool frontSpotLights FALSE
SFBool rearMirror FALSE
SFBool leftWingMirror FALSE
SFBool rightWingMirror FALSE
SFFloat mirrorFar 200.0
MFNode sensorsSlotFront []
MFNode sensorsSlotRear []
MFNode sensorsSlotTop []
MFNode sensorsSlotCenter []
SFBool interior TRUE
SFBool dynamicSpeedDisplay TRUE
SFBool indicatorLevers TRUE
SFNode steeringWheel CarSteeringWheel {}
SFBool completeInterior TRUE
SFBool shifter TRUE
SFFloat outerWindowTransparency 0.4
SFFloat innerWindowTransparency 0.7
SFBool innerWindowDust FALSE
SFString window "automobile"
}
```

> **File location**: "[WEBOTS\_HOME/projects/vehicles/protos/bmw/BmwX5.proto]({{ url.github_tree }}/projects/vehicles/protos/bmw/BmwX5.proto)"
> **License**: Copyright Cyberbotics Ltd. Licensed for use only with Webots.
[More information.](https://cyberbotics.com/webots_assets_license)

### BmwX5 Field Summary

- `color`: Defines the car body color.

- `windshieldWipers`: Defines whether the car should have windshiel wipers.

- `frontSpotLights`: Defines whether the car should have front spot lights.

- `rearMirror`: Defines whether the car should have a rear mirror.

- `leftWingMirror`: Defines whether the car should have a left wing mirror.

- `rightWingMirror`: Defines whether the car should have a right wing mirror.

- `mirrorFar`: Defines the far clipping plane for the rear, left and right mirrors.

- `sensorsSlotFront`: Extends the robot with new nodes on the front of the car.

- `sensorsSlotRear`: Extends the robot with new nodes on the back of the car.

- `sensorsSlotTop`: Extends the robot with new nodes on the roof of the car.

- `sensorsSlotCenter`: Extends the robot with new nodes at the center of the car.

- `interior`: Defines whether the car should have the interior walls and the dashboard.

- `dynamicSpeedDisplay`: Defines whether the current speed can be displaed in the dashboard.

- `indicatorLevers`: Defines whether the car has indicator levers.

- `steeringWheel`: Defines the car steering wheel.

- `completeInterior`: Defines whether the interior of the car should have seats, armrests, and handbrake.

- `shifter`: Defines whether the interior of the car should have the gear shifter.

- `outerWindowTransparency`: Defines the transparency level of the windows seen from outside.

- `innerWindowTransparency`: Defines the transparency level of the windows seen from inside.

- `innerWindowDust`: Defines whether there is dust on windows seen from inside.

## BmwX5Simple

Simple kinematic model of the BMW X5 to be moved with a Supervisor.
This model was sponsored by the CTI project RO2IVSim ([http://transport.epfl.ch/simulator-for-mobile-robots-and-intelligent-vehicles](http://transport.epfl.ch/simulator-for-mobile-robots-and-intelligent-vehicles)).

%figure

![BmwX5Simple](images/bmw/BmwX5Simple.thumbnail.png)

%end

Derived from [Robot](../reference/robot.md).

```
BmwX5Simple {
SFVec3f translation 0 0 0.4
SFRotation rotation 0 0 1 0
SFColor color 0.43 0.11 0.1
MFColor recognitionColors [ 0.43 0.11 0.1 ]
SFString name "vehicle"
SFString controller "<none>"
MFString controllerArgs [ ]
SFString window "<none>"
MFNode sensorsSlotFront [ ]
MFNode sensorsSlotRear [ ]
MFNode sensorsSlotTop [ ]
MFNode sensorsSlotCenter [ ]
SFBool wheelBoundingObject FALSE
}
```

> **File location**: "[WEBOTS\_HOME/projects/vehicles/protos/bmw/BmwX5Simple.proto]({{ url.github_tree }}/projects/vehicles/protos/bmw/BmwX5Simple.proto)"
> **License**: Copyright Cyberbotics Ltd. Licensed for use only with Webots.
[More information.](https://cyberbotics.com/webots_assets_license)

### BmwX5Simple Field Summary

- `color`: Defines the car body color.

- `sensorsSlotFront`: Extends the robot with new nodes on the front of the car.

- `sensorsSlotRear`: Extends the robot with new nodes on the back of the car.

- `sensorsSlotTop`: Extends the robot with new nodes on the roof of the car.

- `sensorsSlotCenter`: Extends the robot with new nodes at the center of the car.

- `wheelBoundingObject`: Defines whether the wheels should have a bounding object.

## BmwX5Wheel

Model of the BMW X5 wheels using the generic [VehicleWheel](vehiclewheel.md) PROTO including physic properties and baseColorMaps.
This model was sponsored by the CTI project RO2IVSim ([http://transport.epfl.ch/simulator-for-mobile-robots-and-intelligent-vehicles](http://transport.epfl.ch/simulator-for-mobile-robots-and-intelligent-vehicles)).

%figure

![BmwX5Wheel](images/bmw/BmwX5Wheel.thumbnail.png)

%end

Derived from [Slot](../reference/slot.md).

```
BmwX5Wheel {
SFString name "BMW X5 wheel"
SFNode physics NULL
SFBool boundingObject TRUE
SFBool wheelSide FALSE
}
```

> **File location**: "[WEBOTS\_HOME/projects/vehicles/protos/bmw/BmwX5Wheel.proto]({{ url.github_tree }}/projects/vehicles/protos/bmw/BmwX5Wheel.proto)"
> **License**: Copyright Cyberbotics Ltd. Licensed for use only with Webots.
[More information.](https://cyberbotics.com/webots_assets_license)

Loading

0 comments on commit 992c706

Please sign in to comment.