FollowPathVehicle broken in Matlab API (3.0)?



  • Hello,

    I'm setting up a simple double lane change path in ANVEL 3.0 with the Matlab API to test path following controllers with different vehicles. I'm wondering if the FollowPathVehicle() service has been removed or is just not working.

    clc, clear all, close all;
    
    % Import the necessary ANVEL structures and enums
    import('com.quantumsignal.anvel.api.*')
    % Add Matlab helper functions to path for conversion to/from complex Java
    % datatypes
    addpath('C:\Program Files\Quantum Signal, LLC\ANVEL Academic Edition\API\Matlab\src')
    
    % Connect to ANVEL
    client = com.quantumsignal.AnvelConnector.AnvelClient('127.0.0.1', 9094);
    anv = client.anvel;
    
    % Pause the simulation timer in case its already running 
    anv.SetSimulationState(SimulationState.PAUSED);
    
    % (re)Load the environment, removing any previously-created objects
    anv.LoadEnvironment('LargeParkingLot.env');
    
    % Create a vehicle
    vehDesc = anv.CreateObject('Generic 4x4', 'myVeh', 0, Point3(0, 0, 0), ...
        Euler(0, 0, 0), true);
    
    % Set up DLC path points
    pathPoints = load('DLCpath.mat');
    pathPoints = pathPoints.path;
    path = convertArrayToListPoint3(pathPoints);
    DLCpath = anv.CreatePath('DLCpath', path);
    
    % Set desired vehicle speed along the path
    kmph2mps = 1000/3600;
    pathSpeed = 60*kmph2mps;
    
    % Load the path for the vehicle to follow
    anv.FollowPathVehicle(vehDesc.objectKey, DLCpath.objectKey, pathSpeed);
    
    % Run the sim
    anv.SetSimulationState(SimulationState.RUNNING_REALTIME);
    

    This gives me the following error:

    Undefined function or variable 'FollowPathVehicle'.
    
    Error in ANVEL_DLC_Carsim_Control (line 60)
    anv.FollowPathVehicle(vehDesc.objectKey, DLCpath.objectKey, pathSpeed);
    

    I can get the sim to run by replacing the call anv.FollowPathVehicle(vehDesc.objectKey, DLCpath.objectKey, pathSpeed); with the following, as it was suggested in this post about the python API.

    followCmd = convertCellArrayToListStrings(cellstr(string({vehDesc.objectKey; DLCpath.objectKey; pathSpeed})));
    anv.SendStringCommandParamList('FollowPath',followCmd);
    

    I'd be interested to know if anyone can reproduce the error I'm seeing, if the API has changed, or if I'm just using it incorrectly.

    Thanks,
    Robert



  • @rjb0026,

    Robert - sorry about the confusion! The API has indeed changed slightly for 3.0. Here is the complete list. We found that the FollowPathVehicle command wasn't sufficient for our user's needs, since a vast majority of the time you'll have to use send string commands anyway, in order to change behaviors beyond just the path follow speed. It looks like your approach is now the correct one.

    Regards,
    The ANVEL Team



  • @ANVEL-Team awesome, thanks. I looked at that page the other day and there wasn't any info on it. I'm glad it is working now!



Looks like your connection to ANVEL Forum was lost, please wait while we try to reconnect.