How to build and execute scenario programmably

  1. I would like to know how can i build and execute scenario programmably in carmaker through python API using some publicly available dataset?

  2. Did carmaker provdie python API interface?

1 Like

Hi Mageo,

Welcome to the Forum.

When you mention Scenario, what do you want to do? Do you want to build the road and traffic from zero? or you have a road and you want to modify progammatically the road and change the traffic?

To build road progammatically, there is an API available in CarMaker but it is not in Python, it is in C

You can find it in the Main CarMaker GUI under Help ā†’ Additional Documents ā†’ IPGRoad API Reference

Regards

Jose

I would like to build a scenario with road and other participantsfrom an autonomous driving dataset(eg:trafficnet,kitti etcā€¦).How can i build this scenario for example free flow or car-man negotiation scenarios(ref:Traffic Net 2.0) in IPG Carmaker?

Is it only possible to build the roads programmatically?How about the road participants?

@jose.nevado

Hello,

Most of the things in CarMaker that can be done graphically can also be automated through the API. That includes adding road participants and setting their behaviour.

The AV datasets that you pointed to usually contain 3D scans of an environment (correct me if Iā€™m wrong). At the moment, producing a virtual scenario from a 3D scan is still quite a challenge in the industry. Itā€™s mostly done by specialised companies and is really costly. If you can get an OpenDRIVE format out of these datasets, you can import that into CarMaker which will save a significant amount of time and eliminate the need to re-create this into native CarMaker.

Apart from that, the things you can automate in CarMaker include (but are probably not limited to):

  • Building a road
  • Adding an ego vehicle at a certain location
  • Setting a desired ego vehicle manoeuvre
  • Doing the same for any number of traffic participants
  • Controlling environmental conditions
  • Programatically building parameterised test scenarios where any number of parameters vary (e.g. ego vehicle initial velocity) to produce a large chunk of similar tests.

Regards,
Bogomil

1 Like

Thank you Bogomil.

In my case,lets say i have the opendrive file and openscenario file. Can i import both these files in Carmaker?.As both the files are in XML,would it be possible to import through ā€˜ā€˜input from fileā€™ā€™ option?

Hello,

Both of those actions are possible, but from different places. ā€œInput from fileā€ is an option reserved for mid-simulation signals, e.g. you can feed an input file of vehicle velocities, traffic states, environmental conditions, but you cannot actually change the building blocks of the simulation in ā€œinput from fileā€.

OpenDRIVE integration is native and relatively easy. There is a button in Scenario Editor that allows you to import a road from a number of different files, one of them being an OpenDrive:

Our OpenScenario support is still a little bit limited, but itā€™s work in progress. I believe itā€™s done through an external tool that converts an OpenScenario to a CarMaker scenario.

Both of these options should be possible to automate and do from the console instead of from the GUI.

Regards,
Bogomil

Hello,

First thanks for this topic discussion because I want to build road automatically using API also. My main purpose is generating rd5. format. However, I could not direct ā€œStart&Connectā€ in App Configuration with executable, which was compiled from the example file (IPGRoadDemo.h, CreateRoadFile.c ā€¦). I also tried paste the code on user.cc in my project, but it did nothing (I just paste and declare somewhere inside, but not in any existing function). So I would like to know how to run the example code from IPGRoad API successfully. Thanks a lot!!

@jose.nevado @bogomil.shtarkalev

1 Like

Hello,

The previous image is unfortunately wrong as it only applies to certain other formats (e.g. KML, CRG, etc).

The correct way to import OpenDRIVE format is through the general ā€œimportā€ of Scenario Editor:

Hello,

The produced IPGRoadDemo.win64.exe executable is a completely separate compiled program and should not be used inside CarMaker.

It can be called from the command line with a few options. These options can be reviewed by typing ā€œIPGRoadDemo.win64.exe -helpā€ in the command line.

The quick start here I guess would be running ā€œIPGRoadDemo.win64.exe -o test.rd5 -createā€ to generate the ā€œtest.rd5ā€ file that is produced by this compiled executable demo.

This is only an example that shows the capability of the API by generating a pre-written road as an example demo. Youā€™d have to create a separate one in C and compile it to generate your own more complex road structure.

Under Ubuntu, replace all ā€œwin64ā€ references from this post to get the correct executable and commands.

1 Like

Thanks you for your response and it helps me a lot! Another question is if I could automatically generate road network and surrounding from zero just through IPGRoad API. I have read documents and saw function ā€œRoadBuilderAutoCompletionā€, but I am not sure if itā€™s used only for extra components adding and adaption of existing road network.

Besides, I would like to know which API inside CarMaker can do the job you have mentioned as a list before, or it just means IPGRoad API. Thank you very much!!

Hi @erty5852

The ā€œRoadBuilderAutoCompleteā€ function can only be used to automatically adapt an already existing road. To build a road from scratch using the RoadAPI, you need to use the functions in roadbuilder.h

Regarding the surrondings, the function ā€œRoadAddSensorObjectā€ should help you with it.
You can find more information in the documentation about it in the Main CarMaker GUI under Help ā†’ Additional Documents ā†’ IPGRoad API

Regards

hello @bogomil.shtarkalev

actually could we automate

  • Building a road in ā†’ Road API and and other things in-> Python API ?

  • Adding an ego vehicle at a certain location

  • Setting a desired ego vehicle manoeuvre

  • Doing the same for any number of traffic participants

  • Controlling environmental conditions

  • Programatically building parameterised test scenarios where any number of parameters vary (e.g. ego vehicle initial velocity) to produce a large chunk of similar tests.

Regards

Hello,

All of those things are possible in CarMaker 12. The only comment I can make is that the RoadAPI is in C, and I am not aware of any plans to convert it to Python one day.

Because our Python API is relatively new, the documentation isnā€™t as refined or in-depth as our TCL (ScriptControl) documentation. Our Python API is about 3 years old, while SciprControl has been around for probably over 30 years.

Hello @bogomil.shtarkalev @jose.nevado

I want to create a Tool that can automatically generate IPG CarMaker road files from human-readable natural language (NLP) text descriptions . I want to transform Human language first at Python and then use API and C to generate Carmaker readable IPG.rd5 file. Could you help me, how should I start that? I donā€™t know , how can I use this example files such as IPGRoadDemo.h, CreateRoadFile.c ,ā€¦ to understand the function . It would be kindly, if you explain how to open these step by step for understanding basic knowledge and how can I write my own programm. Thanks!

Hello, CarMaker has native support for OpenDRIVE files. I would strongly suggest looking at generating OpenDRIVE files instead of rd5.
The reason for this is that what you want is already extremely complicated. OpenDRIVE is a global open standard, so itā€™s your best chance of finding another piece of work or documentation that you can use as a stepping stone.

Hi, Thanks for Support , as I know your example files generate rd.5 road and I want to use them to understand the main functions and input parameters for 50m long road , which be created through this Codes. How should I run them step by step to get the rd5.file . One another question is, how would be complex to write a code to generate the whole test case including traffic, road, car ā€¦ in order to build very simple scenario. thanks a lot.

Hi, you were talking about building and execute scenario programmably in carmaker through python API using some publicly available dataset for this you can google


DTwP Vaccine