gmnvh / pycarmaker

Class to control and read information from CarMaker (https://ipg-automotive.com/)
41 stars 13 forks source link

Unable to Override CarMaker Maneuver Speed via pycarmaker's DVA_write() #17

Open mratanusarkar opened 5 months ago

mratanusarkar commented 5 months ago

Description

I am currently using the pycarmaker library to programmatically control vehicle speeds in CarMaker simulations. However, I've encountered an issue where I am unable to override the speed set by CarMaker maneuvers using the DVA_write() method.

The script does not seem to affect the speed as defined by the existing maneuvers in CarMaker's GUI.

Here is a snippet from my script that @Abb2907 and I am trying to work on to control ego vehicle speed from an external python script:

   from pycarmaker import CarMaker, Quantity
   import time

   # Initialize and connect to CarMaker
   cm = CarMaker("localhost", 16660)
   cm.connect()

   # Create a Quantity for the desired velocity
   speed = Quantity("Car.v", Quantity.FLOAT)

   # Set the desired speed 
   target_speed_value = 60  # Speed in m/s

   # Write the desired speed to CarMaker
   cm.DVA_write(speed, target_speed_value)

   # Wait to observe the effect
   time.sleep(10)

Steps to Reproduce

  1. Set up a maneuver in CarMaker with a specified speed limit.
  2. Use the snippet from the Python script shared above to attempt to override the speed using pycarmaker:

Expected Behavior

The vehicle's speed in the simulation should be overridden to 60 m/s, regardless of the speed set in the predefined maneuver.

Actual Behavior

The vehicle continues to adhere to the speed limit set by the CarMaker maneuver, and the speed override through the script has no effect.

Environment

CarMaker version: 11 Operating System: Windows 10

gmnvh commented 4 months ago

Hi @mratanusarkar, thanks for using pycarmaker.

Some quantities, like Car.v, can not be written. A good way to know is open the Direct Variable Access windows (Application->Direct Variable Access) and see the quantities in blue. These are the ones you can write to.

image