RemoteCanClient
TimeoutHTTPAdapter
TimeoutHTTPAdapter (*args, **kwargs)
*TimeoutHTTPAdapter is used to set a default timeout for all requests
Reference: https://findwork.dev/blog/advanced-usage-python-requests-timeouts-retries-hooks/#retry-on-failure*
RemoteCanClient
RemoteCanClient (host:str, port:str, truck:tspace.config.vehicles.Truck, proxies:Optional[Dict]=None, max_connections:int=1, logger:Optional[logging.Logger]=None, dict_logger:Optional[Dict]=None)
*RemoteCanClient is used to send torque map to the remote can server and get observation signals from the server.
Attributes:
url: str
The url of the remote can server, generated from host and port.
host: str
The host of the remote can server.
port: str
The port of the remote can server.
truck: Truck
The truck object.
proxies: Optional[Dict]
The proxies used to connect to the remote can server.
max_connections: int
The maximum number of connections to the remote can server.
logger: Optional[logging.Logger]
The logger used to log the information.
dict_logger: Optional[Dict]
The dictionary logger used to log the information.*
Type | Default | Details | |
---|---|---|---|
host | str | host name for remote can server | |
port | str | port number for remote can server | |
truck | Truck | truck object which RemoteCanClient is attached to | |
proxies | Optional | None | optional proxies for remote can server |
max_connections | int | 1 | maximum number of connections to remote can server |
logger | Optional | None | logger for RemoteCanClient |
dict_logger | Optional | None | dictionary logger for RemoteCanClient |
RemoteCanClient.send_torque_map
RemoteCanClient.send_torque_map (pedal_map:pandas.core.frame.DataFrame, swap:bool=True, timeout=32)
*Send torque map to the remote can server.
Args: pedal_map: pd.DataFrame The torque map to be sent to the remote can server. swap: bool Whether to swap the pedal map. timeout: int The timeout for the request.
Returns: json_ret: Dict The response from the remote can server if successful.*
Type | Default | Details | |
---|---|---|---|
pedal_map | DataFrame | The torque map to be sent to the remote can server. | |
swap | bool | True | Whether to swap the pedal map. |
timeout | int | 32 | The timeout for the request. |
Returns | Dict | The response from the remote can server if successful |
RemoteCanClient.get_signals
RemoteCanClient.get_signals (duration, timeout=32)
*Get observation signals from the remote can server.
Args: duration: int The duration of the signals to be retrieved. timeout: int The timeout for the request.
Return: json_ret: Dict The response from the remote can server (a dictionary containing the observation) if successful.*
Type | Default | Details | |
---|---|---|---|
duration | The duration of the signals to be retrieved. | ||
timeout | int | 32 | The timeout for the request. |
Returns | Dict |