Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit speed with BMW JSDK on 116i programmatically from Java?

Tags:

java

rfid

carlet

I'm experimenting with the BMW Java SDK on the new BMW 116i Innovation Package. Basic things like turning the lights on and off, starting and stopping the motor work fine. What I'm trying to do now is that to write a carlet which would limit the speed to the maximum configured in the driver profile. Driver identity will be detected as usual via RFID reader.

My problem is that though I can read the speed from the tachometer, I can't really limit the speed. Here's what I've got working so far:

public class SpeenControllingCarlet extends GenericCarlet {

    public void start(final VehicleModel model) throws CarletException {
        RfidReader rfidReader = (RfidReader) model
                .getDevice(Devices.DRIVER_RFID_READER);
        Rfid rfid = rfidReader.getRfid();
        DriverProfile driverProfile = model.getDriverProfileRegistry()
                .getDriverProfile(rfid.toString());
        if (driverProfile == null) {
            return;
        }
        final Double maxAllowedSpeed = Double.valueOf(driverProfile
                .getCustomAttribute("maxAllowedSpeed", "190"));
        Tachometer tachometer = (Tachometer) mode.getDevice(Devices.TACHOMETER);
        tachometer.addSpeedListener(new SpeedListener() {
            public void onSpeedChanged(SpeedChangedEvent speedChangedEvent) {
                if (speedChangedEvent.getCurrentSpeed() > maxAllowedSpeed)
                {
                    Horn horn = (Horn) mode.getDevice(Devices.HORN);
                    horn.beep(440, 2000);
                }

            }
        });
    }
}

This will just beep for two seconds if the driver goes faster than the driver profile allows.

My question is - is there a possibility to actually limit the speed (not just silly beeping)?

like image 785
lexicore Avatar asked Apr 01 '10 00:04

lexicore


3 Answers

How do you slow down using the imperfect human? You brake! Same with BMW SDK:

Brake brake = (Brake) mode.getDevice(Devices.BRAKE);
brake.apply(Brake.TO_THE_METAL);
like image 60
Vladimir Dyuzhev Avatar answered Nov 14 '22 01:11

Vladimir Dyuzhev


Wrench wrench = (Wrench) Toolkit.getToolkit().get(Instruments.WRENCH);
wrench.hit(driver);
like image 22
mvmn Avatar answered Nov 14 '22 01:11

mvmn


I think (and hope) that this is very likely not possible, and the reasons are that car manufacturers would be in a lot of legal trouble if they allowed "non-core" gadgets like a JVM built into the entertainment/navigation system to interfere with the motor or steering controls. That is a much worse security risk than your average browser exploit.

Fly-by-wire cars are scary enough as it is without end-user/hacker accessible parts.

like image 3
Thilo Avatar answered Nov 14 '22 01:11

Thilo