# Automotive/EV projects/packages?

**URL:** https://discourse.julialang.org/t/automotive-ev-projects-packages/77533
**Category:** Maker
**Created:** [March 7, 2022, 6:08pm UTC](https://discourse.julialang.org/t/automotive-ev-projects-packages/77533 "2022-03-07T18:08:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![airpmb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/airpmb/32/7826_2.png) [@airpmb](https://discourse.julialang.org/u/airpmb)
#### Post date: [March 7, 2022, 6:08pm UTC](https://discourse.julialang.org/t/automotive-ev-projects-packages/77533/1 "2022-03-07T18:08:49Z")

</div>

So I’m looking to dabble a bit with data from an OBD2 scanner, mostly to explore aspects of my EV’s energy consumption, and/or something about how the charging infrastructure is evolving, if I can find an appropriate API out there for such data.

I don’t really have a specific project in mind yet but in the longer term it would be really cool to somehow be able to determine optimal route/driving/charging patterns and with measured data figure out how well I’m doing relative to this. Which would obviously be a pretty lofty goal so for now I’d like to start by tinkering with data collection & analysis.

Has anyone done anything in these areas?

---

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [March 7, 2022, 6:50pm UTC](https://discourse.julialang.org/t/automotive-ev-projects-packages/77533/2 "2022-03-07T18:50:01Z")

</div>

I haven’t heard of anything related to OBD2 and Julia (otherwise a number of Julia packages are available for very exotic interfaces/hardware), and googled and found nothing. Only for Python: [python-OBD](https://python-obd.readthedocs.io/en/latest/)

> It can stream real time sensor data

[That package works on Raspberry Pi, Julia itself does too, and I think also packages below I mention.]

I’m not really recommending Python over Julia (but it’s an option), rather using that (or some other?) package from Julia. With e.g. PythonCall (I hear it’s excellent, and it takes care of Python dependencies).

It has a rather slow startup (but should be fine, at least after startup on Raspberry Pi):

```julia
julia> @time using PythonCall
  4.598435 seconds (2.44 M allocations: 171.395 MiB, 1.04% gc time, 84.54% compilation time)

```

PyCall.jl has a faster startup, is know to be excellent (so might be more appropriate, at least on the slower RPi), but you have to manually install Python dependencies (not really a problem).

This is more advanced than you seem asking for, but Julia is used in autonomous/self-driving research:

[http://anthonylcorso.com/wp-content/uploads/2021/02/thesis.pdf](http://anthonylcorso.com/wp-content/uploads/2021/02/thesis.pdf)

> **[GitHub - sisl/AdversarialDriving.jl: Adversarial driving simulator for...](https://github.com/sisl/AdversarialDriving.jl)**
>
> Adversarial driving simulator for testing safety validation algorithms - GitHub - sisl/AdversarialDriving.jl: Adversarial driving simulator for testing safety validation algorithms

Everything I’ve seen for Julia for hard-realtime, is not yet used in actual hardware, that I know of (but would like to be proven wrong, i.e. only used in a simulation). But since people trust Julia for hard-realtime, and use (with care to avoid the GC) rather than C++ or Java, then it seems plausible also for self-driving…, while I doubt it will be used (soon) for that in actual hardware, or with pure Julia.

That said, you seemingly don’t need hard-realtime, only needs soft-realtime (or even best-effort), what I assume “real time” means for the above Python package.

[https://www.researchgate.net/publication/331983442\_Julia\_for\_robotics\_simulation\_and\_real-time\_control\_in\_a\_high-level\_programming\_language](https://www.researchgate.net/publication/331983442_Julia_for_robotics_simulation_and_real-time_control_in_a_high-level_programming_language)

> We demonstrate the use of the Julia programming language to solve this problem by being fast enough for online control of a humanoid robot and flexible enough for prototyping. We present several Julia packages developed by the authors, which together enable roughly 2× realtime simulation of the Boston Dynamics Atlas humanoid robot balancing on flat ground using a quadratic-programming-based controller

> **[Programing Robot Locomotion using JuliaHub - Case Study](https://juliahub.com/case-studies/mit-robotics/)**
>
> The MIT Robot Locomotion Group uses Julia's simulation controls and multiple platform Support. Learn more about the speed and accuracy of Julia.

This one is actual hardware, and Julia helped, but it seems only for the simulation:

> **[Aerospace Modeling and Simulation - JuliaHub Case Study](https://juliahub.com/case-studies/zipline/)**
>
> Discover how Zipline uses Julia aircraft simulation to deliver life-saving emergency medical supplies via drone in Africa and other places worldwide.

I just got curious seeing this (at least this package doesn’t seem to be for controlling a robot):

> **[GitHub - StanfordASL/AstrobeeRobot.jl: URDF and meshes for the Astrobee...](https://github.com/StanfordASL/AstrobeeRobot.jl)**
>
> URDF and meshes for the Astrobee free-flying robot - GitHub - StanfordASL/AstrobeeRobot.jl: URDF and meshes for the Astrobee free-flying robot

> **[Astrobee - NASA](https://www.nasa.gov/astrobee/)**
>
> NASA has developed three new robotic teammates to work alongside astronauts on the International Space Station as they help to advance research.

> Astrobee, NASA’s new free-flying robotic system, will help astronauts reduce time they spend on routine duties, […]  
> The Astrobee system consists of three cubed-shaped robots

---

<div class="post-metadata">

### Author: ![airpmb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/airpmb/32/7826_2.png) [@airpmb](https://discourse.julialang.org/u/airpmb)
#### Post date: [March 7, 2022, 7:46pm UTC](https://discourse.julialang.org/t/automotive-ev-projects-packages/77533/3 "2022-03-07T19:46:56Z")

</div>

Thanks for the pointers!

Yeah for now I’m definitely fine with just logging data while I drive and analyzing it offline later. So far I have a Bluetooth OBD2 dongle and an app that does logging, with sync to iCloud which makes it pretty nice, basically I just need to start an app on my phone to log and a CSV file will have appeared in my filesystem when I get home.

I guess one could effectively DIY the app + cloud sync part with the RPi replacing the phone but at least for the time being this is more than what I need. Maybe even the Bluetooth dongle could be replaced, I haven’t looked into how far off it is from basically a serial port. What could be nice about the RPi is logging during charging though I’m not sure my car/dongle supports that.
