CAN based AOG setup with virtual testing

Okay, so thought I’d start a new topic on this one. Been working now on making AOG work with a J1939 Isobus valve (Danfoss PVEA-CI, but should work for all that use the standard PGNs) and a J1939 WAS (Danfoss DST510) with a Teensy 4.0 running the code.

To test the setup without having all the hardware at hand, I’ve setup a python application running on Raspi3B+ with a PiCAN shield, it uses python-can, so socketcan in the background. The python application includes the following bits

  • Model for the hydraulic valve. Currently it just reads the CAN message to the valve and calculates flow accordingly. You can se the max flow in the constructor and also the deadband of the valve. Control signal is as per standard 0-250, and it constructs a second order polynomial for the flow from deadband zero to max flow. This is assuming that a pressure compensated valve is used, so the flow stays roughly constant regardless or the resistance from turning the wheels.
  • Model for the steer cylinder. This just takes the stroke and area of the cylinder as input and does the time stepping based on flow.
  • Model for the CAN wheel angle sensor. Takes in the angle and transmits a CAN message according to Danfoss DST510 datasheet.
  • Model for the steering rack. Constructor takes in the kingpin, steering cylinder end joint and tie rod end joint positions and does the calculations for steer angle based on hydraulic cylinder displacement. So it actually models the Ackermann effect based on the actual geometry, wheel angle is different when turning left or right. Angle is calculated for the right hand side kingpin.
  • Additionally there’s a model for the SASAIID steering wheel angle sensor, if you want to use that for disengaging the steering.

The models are currently missing all the address claim, error handling etc., just the bare minimums for stuff to work. You can just run it on raspian with no edits, just start the can socket with txqueuelen 1000 or something like that.

The .ino included is quick and dirty edit on the beta 5004 .ino. WAS from analogue is replaced with reading the WAS from CAN, some edits to handle ints correctly in the 32bit environment, and the Cytron driver is replaced with valve commands. Runnning on Flexcan_T4, that’s not included so you need to fetch from github. Finally, the link to github and a demo video:

8 Likes