9 ms·
There's no Android GC, there's a Java GC. Python on Android isn't written in Java, it's CPython, written in C. Python has a GC as well, but we turn it off for
by commaai 8y ago
There's no Android GC, there's a Java GC. Python on Android isn't written in Java, it's CPython, written in C.
Python has a GC as well, but we turn it off for the control loop processes. https://github.com/commaai/openpilot/blob/devel/selfdrive/controls/controlsd.py#L398 https://github.com/commaai/openpilot/blob/devel/selfdrive/co...
Haters love to bring up the Python, but they never stick around long enough to explain exactly why it's a problem.
- woolvalley 8y agoBecause it's not a statically typed language for the most part, which brings in an entire class of bugs of its own. It's also an extremely mutable language. Great for scripts, but there is a reason why most large companies start bolting on types on whatever dynamic language they started with.
- fulafel 8y agoMost production languages that nominally do some static typing aren't statically very safe - certainly Java, Go, C/C++ are rife with runtime errors. After the required testing to eliminate those, it's not clear Python is significantly different. Edit: also, Python does eagerly signal type errors, unlike say Javascript or C, so you don't get silently wrong answers. C is the default language in auto industry. . Yeah, this is a bit of whataboutism, certainly it would be nice if the state of the art in production languages was closer to the ideal of statically verified... Haskell and Rust are in the right direction, and would be clearly superior in this regard
- woolvalley 8y agoI wasn't implying that static types solve everything, they just make things n+1 better and remove a class of bugs. Statically typed languages are mature and you have no excuse not using them if your doing anything that approaching a need for reliability. Cars do, social cat pictures, not so much.
- fulafel 8y agoWhat about Erlang?
- scintill76 8y agoAndroid is not typically a realtime OS. The root of the point, about uncontrolled pauses, is valid IMO.
- naikrovek 8y agoThe safety-relevant code runs on a microcontroller in the CAN dongle and is written in C. Why does everyone assume the phone is doing all the work?
- deleted 8y ago[deleted]
- orbifold 8y agoLack of type safety and static analysis tools. You can't apply formal verification to it. I wouldn't sit in a car in which any safety critical component was driven by python. Hopefully you would also not be able to get it certified for road use. I happen to know people that work on these problems for German automotive companies. This wouldn't fly there. I truly hope that solid engineering wins out over these approaches. That being said I admire the audacity.
- ethanwillis 8y agoBecause German automotive companies are known for making systems that are robust and not just faking results.
- rain1 8y agoI think it's great that your code is open source. The other self driving cars are all based on secret code that the public is not allowed to inspect or audit. This is extremely worrying. Having your code open source means that outsiders will notice flaws in it, try not to "push back" too much against them. Sometimes they will point out serious flaws that allow you to improve your code significantly, sometimes they will point out non-issues or simply be wrong about things. So instead you should embrace it and take the time to consider the feedback. The crowd is a valuable resource that you have, that closed source projects don't.
- wilsonnb2 8y ago> But the software that enables the semi-autonomous driving is free to download. Hotz says this allows him to sidestep the regulatory issue, though it’s unclear whether NHTSA would agree. “We aren’t selling any products that control a car,” he says. “We are giving away free software, and software is speech.” (A spokesperson for NHTSA did not respond to a request for comment.) Sounds like they're just using open source to avoid liability and side step regulators. I love open source, but I do not think it's being used for benevolent reasons here.
- rain1 8y agoYow! Shows how naive I am. Thanks for the reply..