Repositioning Vehicle and Restarting Simulation in CarMaker Using Python

I am currently working on a Python code to interact with vehicle states in CarMaker, both for reading and writing purposes. As part of my AI model training, I require the ability to reposition the vehicle on a specified route and subsequently restart the simulation.

To achieve this, I am utilizing the Python class provided by gmnvh, available on GitHub [link: GitHub - gmnvh/pycarmaker: Class to control and read information from CarMaker (]. My initial plan was to use the following commands:

veh_start_pos = Quantity(“Vehicle.StartPos”, Quantity.FLOAT)
cm.DVA_write(veh_start_pos, (0, 0))

In this code snippet, cm.DVA_write() is responsible for sending a DVA write request, while cm.restart_sim() triggers a StartSim command. However, it appears that accessing “Vehicle.StartPos” in this manner is not successful.

I would greatly appreciate any insights or suggestions you might have on how to accomplish this task effectively. Thank you in advance for your assistance.

It’s a little difficult to comment on the code in that specific Github repository as this is not something developed by IPG as far as I am aware. We do however provide an official Python API with CarMaker which I would recommend you investigate. The latest CarMaker release of the Python API also includes a Python interface for our APO client which would allow you to read and write quantities during a simulation. You should keep in mind that not all quantities can be overwritten during a simulation. You should check the reference manual for user accessible quantities.

I believe Vehicle.StartPos is a Road parameter defined in the Road/TestRun file. This probably isn’t something you can alter at runtime. If you want to create different variations based on TestRun parameters then you could use the Python API. Examples of creating TestRun variations can be found in the Python API reference manual available from the Help > Additional Documents menu in CarMaker GUI.

1 Like

Thank you Mr. Barry for your thorough response. Is it possible to request a help session from the IPG team to assist me in getting started with the Python API? I am not an expert in XIL programming.

For 1:1 sessions I would suggest to reach out to your local IPG office who I am sure would be very happy to support. Which customer and country are you from (feel free to send me this in a private message if you would rather not post public)? Do you already have contact with your local office?

You could also use our support request form on the website Support request | IPG Automotive

1 Like

Thank you very much for your reply. I just sent you my information in a private message. Please let me know should you need additional details. Thanks again.