Messages - actuators#

These messages are used to carry information about the state of the actuators in the system. Examples of actuators are motors, LEDs, and Display.

DifferentialPWM#

This message is used to describe the speed of the left and right wheels of a differential drive robot.

Note

This message can be used both as an input (control the robot) and as an output (report the robot’s state).

pydantic model duckietown_messages.actuators.differential_pwm.DifferentialPWM#

Show JSON schema
{
   "title": "DifferentialPWM",
   "type": "object",
   "properties": {
      "header": {
         "title": "Header",
         "description": "Auto-generated header",
         "allOf": [
            {
               "$ref": "#/definitions/Header"
            }
         ]
      },
      "left": {
         "title": "Left",
         "description": "PWM signal magnitude between -1 and 1 for the left wheel",
         "minimum": -1,
         "maximum": 1,
         "type": "number"
      },
      "right": {
         "title": "Right",
         "description": "PWM signal magnitude between -1 and 1 for the right wheel",
         "minimum": -1,
         "maximum": 1,
         "type": "number"
      }
   },
   "required": [
      "left",
      "right"
   ],
   "definitions": {
      "Header": {
         "title": "Header",
         "type": "object",
         "properties": {
            "version": {
               "title": "Version",
               "description": "Version of the message this header is attached to",
               "default": "1.0",
               "pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$",
               "example": "0.1.3",
               "type": "string"
            },
            "frame": {
               "title": "Frame",
               "description": "Reference frame this data is captured in",
               "type": "string"
            },
            "txt": {
               "title": "Txt",
               "description": "Auxiliary data attached to the message",
               "type": "object"
            }
         }
      }
   }
}

Fields
field header: duckietown_messages.standard.header.Header [Optional]#

Auto-generated header

field left: float [Required]#

PWM signal magnitude between -1 and 1 for the left wheel

Constraints
  • minimum = -1

  • maximum = 1

field right: float [Required]#

PWM signal magnitude between -1 and 1 for the right wheel

Constraints
  • minimum = -1

  • maximum = 1

classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) Model#

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) Model#

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny#

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

classmethod from_orm(obj: Any) Model#
classmethod from_rawdata(rd: dtps_http.structures.RawData) duckietown_messages.base.BaseMessage#
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode#

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

classmethod parse_file(path: Union[str, pathlib.Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model#
classmethod parse_obj(obj: Any) Model#
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model#
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') DictStrAny#
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) unicode#
to_rawdata() dtps_http.structures.RawData#
classmethod update_forward_refs(**localns: Any) None#

Try to update ForwardRefs on fields based on this Model, globalns and localns.

classmethod validate(value: Any) Model#

CarLights#

This message is used to describe the state of the lights of a Duckiebot.

Note

This message can be used both as an input (control the lights) and as an output (report the robot’s state).

pydantic model duckietown_messages.actuators.car_lights.CarLights#

Show JSON schema
{
   "title": "CarLights",
   "type": "object",
   "properties": {
      "header": {
         "title": "Header",
         "description": "Auto-generated header",
         "allOf": [
            {
               "$ref": "#/definitions/Header"
            }
         ]
      },
      "front_left": {
         "title": "Front Left",
         "description": "Front left light color and intensity",
         "allOf": [
            {
               "$ref": "#/definitions/RGBA"
            }
         ]
      },
      "front_right": {
         "title": "Front Right",
         "description": "Front right light color and intensity",
         "allOf": [
            {
               "$ref": "#/definitions/RGBA"
            }
         ]
      },
      "rear_left": {
         "title": "Rear Left",
         "description": "Rear left light color and intensity",
         "allOf": [
            {
               "$ref": "#/definitions/RGBA"
            }
         ]
      },
      "rear_right": {
         "title": "Rear Right",
         "description": "Rear right light color and intensity",
         "allOf": [
            {
               "$ref": "#/definitions/RGBA"
            }
         ]
      }
   },
   "required": [
      "front_left",
      "front_right",
      "rear_left",
      "rear_right"
   ],
   "definitions": {
      "Header": {
         "title": "Header",
         "type": "object",
         "properties": {
            "version": {
               "title": "Version",
               "description": "Version of the message this header is attached to",
               "default": "1.0",
               "pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$",
               "example": "0.1.3",
               "type": "string"
            },
            "frame": {
               "title": "Frame",
               "description": "Reference frame this data is captured in",
               "type": "string"
            },
            "txt": {
               "title": "Txt",
               "description": "Auxiliary data attached to the message",
               "type": "object"
            }
         }
      },
      "RGBA": {
         "title": "RGBA",
         "type": "object",
         "properties": {
            "header": {
               "title": "Header",
               "description": "Auto-generated header",
               "allOf": [
                  {
                     "$ref": "#/definitions/Header"
                  }
               ]
            },
            "r": {
               "title": "R",
               "description": "Intensity of the red component of the color in the range [0, 1]",
               "minimum": 0,
               "maximum": 1,
               "type": "number"
            },
            "g": {
               "title": "G",
               "description": "Intensity of the green component of the color in the range [0, 1]",
               "minimum": 0,
               "maximum": 1,
               "type": "number"
            },
            "b": {
               "title": "B",
               "description": "Intensity of the blue component of the color in the range [0, 1]",
               "minimum": 0,
               "maximum": 1,
               "type": "number"
            },
            "a": {
               "title": "A",
               "type": "number"
            }
         },
         "required": [
            "r",
            "g",
            "b",
            "a"
         ]
      }
   }
}

Fields
field header: duckietown_messages.standard.header.Header [Optional]#

Auto-generated header

field front_left: duckietown_messages.colors.rgba.RGBA [Required]#

Front left light color and intensity

field front_right: duckietown_messages.colors.rgba.RGBA [Required]#

Front right light color and intensity

field rear_left: duckietown_messages.colors.rgba.RGBA [Required]#

Rear left light color and intensity

field rear_right: duckietown_messages.colors.rgba.RGBA [Required]#

Rear right light color and intensity

classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) Model#

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) Model#

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny#

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

classmethod from_orm(obj: Any) Model#
classmethod from_rawdata(rd: dtps_http.structures.RawData) duckietown_messages.base.BaseMessage#
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode#

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

classmethod parse_file(path: Union[str, pathlib.Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model#
classmethod parse_obj(obj: Any) Model#
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model#
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') DictStrAny#
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) unicode#
to_rawdata() dtps_http.structures.RawData#
classmethod update_forward_refs(**localns: Any) None#

Try to update ForwardRefs on fields based on this Model, globalns and localns.

classmethod validate(value: Any) Model#

DisplayFragment#

Display fragments are 2D binary images that can be displayed on the screen. Fragments can be used to display text, icons, or other images. The overall content of the screen is defined by a list of fragments pasted in various locations and visible at the same time. This message is used to describe a fragment that can be displayed on a Duckiebot’s screen.

pydantic model duckietown_messages.actuators.display_fragment.DisplayFragment#

Show JSON schema
{
   "title": "DisplayFragment",
   "type": "object",
   "properties": {
      "header": {
         "title": "Header",
         "description": "Auto-generated header",
         "allOf": [
            {
               "$ref": "#/definitions/Header"
            }
         ]
      },
      "name": {
         "title": "Name",
         "description": "ID of the fragment, used to update fragments that repeat over time",
         "type": "string"
      },
      "region": {
         "title": "Region",
         "description": "Display region this fragment should be rendered on",
         "type": "integer"
      },
      "page": {
         "title": "Page",
         "description": "Page this fragment should be rendered on",
         "minimum": 0,
         "type": "integer"
      },
      "content": {
         "title": "Content",
         "description": "Fragment content",
         "allOf": [
            {
               "$ref": "#/definitions/Image"
            }
         ]
      },
      "location": {
         "title": "Location",
         "description": "Location on the display where to show the fragment",
         "allOf": [
            {
               "$ref": "#/definitions/ROI"
            }
         ]
      },
      "z": {
         "title": "Z",
         "description": "Z-index of the fragment",
         "minimum": 0,
         "type": "integer"
      },
      "ttl": {
         "title": "Ttl",
         "description": "Time-to-Live in seconds of the fragment (-1 for infinite, do not abuse)",
         "type": "integer"
      }
   },
   "required": [
      "name",
      "region",
      "page",
      "content",
      "location",
      "z",
      "ttl"
   ],
   "definitions": {
      "Header": {
         "title": "Header",
         "type": "object",
         "properties": {
            "version": {
               "title": "Version",
               "description": "Version of the message this header is attached to",
               "default": "1.0",
               "pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$",
               "example": "0.1.3",
               "type": "string"
            },
            "frame": {
               "title": "Frame",
               "description": "Reference frame this data is captured in",
               "type": "string"
            },
            "txt": {
               "title": "Txt",
               "description": "Auxiliary data attached to the message",
               "type": "object"
            }
         }
      },
      "Image": {
         "title": "Image",
         "type": "object",
         "properties": {
            "header": {
               "title": "Header",
               "description": "Auto-generated header",
               "allOf": [
                  {
                     "$ref": "#/definitions/Header"
                  }
               ]
            },
            "width": {
               "title": "Width",
               "description": "Width of the image",
               "minimum": 0,
               "type": "integer"
            },
            "height": {
               "title": "Height",
               "description": "Height of the image",
               "minimum": 0,
               "type": "integer"
            },
            "encoding": {
               "title": "Encoding",
               "description": "The encoding of the pixels",
               "enum": [
                  "rgb8",
                  "rgba8",
                  "bgr8",
                  "bgra8",
                  "mono1",
                  "mono8",
                  "mono16"
               ],
               "type": "string"
            },
            "step": {
               "title": "Step",
               "description": "Full row length in bytes",
               "minimum": 0,
               "type": "integer"
            },
            "data": {
               "title": "Data",
               "description": "Pixel data. Size must be (step * rows)",
               "type": "string",
               "format": "binary"
            },
            "is_bigendian": {
               "title": "Is Bigendian",
               "description": "Is the data bigendian?",
               "type": "boolean"
            }
         },
         "required": [
            "width",
            "height",
            "encoding",
            "step",
            "data",
            "is_bigendian"
         ]
      },
      "ROI": {
         "title": "ROI",
         "type": "object",
         "properties": {
            "header": {
               "title": "Header",
               "description": "Auto-generated header",
               "allOf": [
                  {
                     "$ref": "#/definitions/Header"
                  }
               ]
            },
            "height": {
               "title": "Height",
               "description": "Height of the region",
               "minimum": 0,
               "type": "integer"
            },
            "width": {
               "title": "Width",
               "description": "Width of the region",
               "minimum": 0,
               "type": "integer"
            },
            "x": {
               "title": "X",
               "description": "Leftmost pixel of the region",
               "default": 0,
               "minimum": 0,
               "type": "integer"
            },
            "y": {
               "title": "Y",
               "description": "Topmost pixel of the region",
               "default": 0,
               "minimum": 0,
               "type": "integer"
            }
         },
         "required": [
            "height",
            "width"
         ]
      }
   }
}

Fields
field header: duckietown_messages.standard.header.Header [Optional]#

Auto-generated header

field name: str [Required]#

ID of the fragment, used to update fragments that repeat over time

field region: int [Required]#

Display region this fragment should be rendered on

field page: int [Required]#

Page this fragment should be rendered on

Constraints
  • minimum = 0

field content: duckietown_messages.sensors.image.Image [Required]#

Fragment content

field location: duckietown_messages.geometry_2d.roi.ROI [Required]#

Location on the display where to show the fragment

field z: int [Required]#

Z-index of the fragment

Constraints
  • minimum = 0

field ttl: int [Required]#

Time-to-Live in seconds of the fragment (-1 for infinite, do not abuse)

property as_mono8: numpy.ndarray#
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) Model#

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) Model#

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny#

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

classmethod from_orm(obj: Any) Model#
classmethod from_rawdata(rd: dtps_http.structures.RawData) duckietown_messages.base.BaseMessage#
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode#

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

classmethod parse_file(path: Union[str, pathlib.Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model#
classmethod parse_obj(obj: Any) Model#
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model#
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') DictStrAny#
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) unicode#
to_rawdata() dtps_http.structures.RawData#
classmethod update_forward_refs(**localns: Any) None#

Try to update ForwardRefs on fields based on this Model, globalns and localns.

classmethod validate(value: Any) Model#

DisplayFragments#

Display fragments can be grouped together and sent to the screen driver as a single message. This message is used to do just that.

pydantic model duckietown_messages.actuators.display_fragments.DisplayFragments#

Show JSON schema
{
   "title": "DisplayFragments",
   "type": "object",
   "properties": {
      "header": {
         "title": "Header",
         "description": "Auto-generated header",
         "allOf": [
            {
               "$ref": "#/definitions/Header"
            }
         ]
      },
      "fragments": {
         "title": "Fragments",
         "description": "Fragments to display",
         "type": "array",
         "items": {
            "$ref": "#/definitions/DisplayFragment"
         }
      }
   },
   "required": [
      "fragments"
   ],
   "definitions": {
      "Header": {
         "title": "Header",
         "type": "object",
         "properties": {
            "version": {
               "title": "Version",
               "description": "Version of the message this header is attached to",
               "default": "1.0",
               "pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$",
               "example": "0.1.3",
               "type": "string"
            },
            "frame": {
               "title": "Frame",
               "description": "Reference frame this data is captured in",
               "type": "string"
            },
            "txt": {
               "title": "Txt",
               "description": "Auxiliary data attached to the message",
               "type": "object"
            }
         }
      },
      "Image": {
         "title": "Image",
         "type": "object",
         "properties": {
            "header": {
               "title": "Header",
               "description": "Auto-generated header",
               "allOf": [
                  {
                     "$ref": "#/definitions/Header"
                  }
               ]
            },
            "width": {
               "title": "Width",
               "description": "Width of the image",
               "minimum": 0,
               "type": "integer"
            },
            "height": {
               "title": "Height",
               "description": "Height of the image",
               "minimum": 0,
               "type": "integer"
            },
            "encoding": {
               "title": "Encoding",
               "description": "The encoding of the pixels",
               "enum": [
                  "rgb8",
                  "rgba8",
                  "bgr8",
                  "bgra8",
                  "mono1",
                  "mono8",
                  "mono16"
               ],
               "type": "string"
            },
            "step": {
               "title": "Step",
               "description": "Full row length in bytes",
               "minimum": 0,
               "type": "integer"
            },
            "data": {
               "title": "Data",
               "description": "Pixel data. Size must be (step * rows)",
               "type": "string",
               "format": "binary"
            },
            "is_bigendian": {
               "title": "Is Bigendian",
               "description": "Is the data bigendian?",
               "type": "boolean"
            }
         },
         "required": [
            "width",
            "height",
            "encoding",
            "step",
            "data",
            "is_bigendian"
         ]
      },
      "ROI": {
         "title": "ROI",
         "type": "object",
         "properties": {
            "header": {
               "title": "Header",
               "description": "Auto-generated header",
               "allOf": [
                  {
                     "$ref": "#/definitions/Header"
                  }
               ]
            },
            "height": {
               "title": "Height",
               "description": "Height of the region",
               "minimum": 0,
               "type": "integer"
            },
            "width": {
               "title": "Width",
               "description": "Width of the region",
               "minimum": 0,
               "type": "integer"
            },
            "x": {
               "title": "X",
               "description": "Leftmost pixel of the region",
               "default": 0,
               "minimum": 0,
               "type": "integer"
            },
            "y": {
               "title": "Y",
               "description": "Topmost pixel of the region",
               "default": 0,
               "minimum": 0,
               "type": "integer"
            }
         },
         "required": [
            "height",
            "width"
         ]
      },
      "DisplayFragment": {
         "title": "DisplayFragment",
         "type": "object",
         "properties": {
            "header": {
               "title": "Header",
               "description": "Auto-generated header",
               "allOf": [
                  {
                     "$ref": "#/definitions/Header"
                  }
               ]
            },
            "name": {
               "title": "Name",
               "description": "ID of the fragment, used to update fragments that repeat over time",
               "type": "string"
            },
            "region": {
               "title": "Region",
               "description": "Display region this fragment should be rendered on",
               "type": "integer"
            },
            "page": {
               "title": "Page",
               "description": "Page this fragment should be rendered on",
               "minimum": 0,
               "type": "integer"
            },
            "content": {
               "title": "Content",
               "description": "Fragment content",
               "allOf": [
                  {
                     "$ref": "#/definitions/Image"
                  }
               ]
            },
            "location": {
               "title": "Location",
               "description": "Location on the display where to show the fragment",
               "allOf": [
                  {
                     "$ref": "#/definitions/ROI"
                  }
               ]
            },
            "z": {
               "title": "Z",
               "description": "Z-index of the fragment",
               "minimum": 0,
               "type": "integer"
            },
            "ttl": {
               "title": "Ttl",
               "description": "Time-to-Live in seconds of the fragment (-1 for infinite, do not abuse)",
               "type": "integer"
            }
         },
         "required": [
            "name",
            "region",
            "page",
            "content",
            "location",
            "z",
            "ttl"
         ]
      }
   }
}

Fields
field header: duckietown_messages.standard.header.Header [Optional]#

Auto-generated header

field fragments: List[duckietown_messages.actuators.display_fragment.DisplayFragment] [Required]#

Fragments to display

classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) Model#

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny] = None, deep: bool = False) Model#

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False) DictStrAny#

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

classmethod from_orm(obj: Any) Model#
classmethod from_rawdata(rd: dtps_http.structures.RawData) duckietown_messages.base.BaseMessage#
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, encoder: Optional[Callable[[Any], Any]] = None, models_as_dict: bool = True, **dumps_kwargs: Any) unicode#

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

classmethod parse_file(path: Union[str, pathlib.Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model#
classmethod parse_obj(obj: Any) Model#
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: pydantic.parse.Protocol = None, allow_pickle: bool = False) Model#
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') DictStrAny#
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) unicode#
to_rawdata() dtps_http.structures.RawData#
classmethod update_forward_refs(**localns: Any) None#

Try to update ForwardRefs on fields based on this Model, globalns and localns.

classmethod validate(value: Any) Model#