Electric car giant Tesla has agreed to settle a lawsuit over a crash in 2018 that killed Apple engineer Walter Huang after his Model X, operating on Autopilot, collided with a highway barrier. The case, brought by Huang's family, was scheduled to begin in the California Superior Court this week. If the trial had gone ahead, it would have brought increased scrutiny of the firm's Autopilot and Full Self-Driving technology. The terms of the settlement were not disclosed and reports have said the deal still needs to be approved by a judge. Tesla did not immediately respond to a BBC request for comment. Before the settlement, Tesla argued that Mr Huang had misused the system because he was playing a video game just before the accident. The firm has previously won trials in California by arguing that drivers involved had not followed its instructions to maintain attention while using the system. The electric vehicle (EV) maker faces a series of lawsuits over crashes related to the alleged use of its driver-assistant technology. The US National Highway Traffic Safety Administration has also been investigating some accidents involving Autopilot. For many years, Tesla has promised to produce an autonomous car but has yet to launch one. On Friday, Mr Musk said the company plans to unveil a self-driving robotaxi in August. The settlement with Mr Huang's family comes at a time when the company is battling weakening sales. Deliveries slid sharply in the first three months of this year as Tesla grappled with a fire at its European factory, global shipping disruption and growing competition. Tesla has cut prices repeatedly in response to increased competition from rivals such as BYD but demand in key markets like China has fallen. Tesla's shares have lost almost a third of their value since the start of this year. — BBC