Community Forum
ANVEL Licensing Options

Lower-level Control with ANVEL API



  • @anvel-team I want to use the ANVEL API to enable the use of software outside of ANVEL to independently control the steering and drive motors of an ANVEL vehicle. I don't see a way to this with the current ANVEL service functionality. Specifically, the SetVehicleInput function takes the VehicleInputRecord struct defined:

    struct VehicleInputRecord
    {
    1:double steering,
    2:double throttle,
    3:double brake
    }

    I'm looking for an input function that accepts a struct with position/velocity commands to each motor at the minimum. Maybe something like this:

    struct wheel_assembly
    {
    1:double drive_motor_velocity,
    2:double steer_motor_position
    }
    struct NewVehicleInputRecord
    {
    1:wheel_assembly left_front,
    2:wheel_assembly left_rear,
    3:wheel_assembly right_front,
    4:wheel_assembly right_rear
    }

    Any advice on how to do this is appreciated.



  • @anvel-team Do you have any suggestions?



  • @samxchandler,

    Sorry it's taken so long to respond! You should be able to achieve individual motor control with the following External API commands. We have an example on this wiki page, but admittedly it's quite buried far down on the page: https://wiki.anvelsim.com/3/index.php/Python_Example_Vehicle_Control

    You can modify the command to control each individual input in your control.xml file.

    #Initialize the vehicles with multiple motors
    vehicle = anv.CreateObject('CRSI', 'Test', 0, Point3(0,0,0), Euler(0, 0, 10), True)
    
    #run the simulation
    anv.SetSimulationState(SimulationState.RUNNING_REALTIME)
    
    #Control the individual throttles for each motor (spin in a circle)
    anv.SendStringCommand("AnvelAPIVehicleController.ControlVehicle", str(vehicle.objectKey) + ";ThrottleR:float64:-1.0|ThrottleL:float64:1.0")
    

    Let us know if this works for you.

    Regards,
    ANVEL Support



  • @anvel-team No problem. Thanks for getting back to me. I think this solves the problem of talking to multiple motors. How do I convert throttle to target drive velocities at this level?



  • @samxchandler,

    We'll take a look! Is it possible to send us your vehicle and script so we can take an in depth look at what you're trying to do?

    Regards,
    ANVEL Support



  • @samxchandler,

    Yes, feel free to email anvel_support@quantumsignal.com.

    Regards,
    ANVEL Support



  • @samxchandler,

    Got the files. We'll take a look.

    Regards,
    ANVEL Support