Hi,
I am using V-REP with Python API to simulate the walking process of my robot, to make the robot perform perfectly, I have to adjust some parameters which could be a heavy work. So I want to run the simulation circularly and adjust these parameters automatically to find the optimums.
But I have no idea to make it in V-REP, could you give me some examples or any tutorials?
Thanks in advance!
Yours,
Matt
how to run simulations circularly and automatically
-
- Posts: 19
- Joined: 31 Aug 2017, 02:11
Re: how to run simulations circularly and automatically
Hello Matt,
the best for that is to use a customization script, that will adjust various parameters when simulation is not running, and that will listen to some signal or other trigger to start and stop a simulation. That customization script could also interact with a remote API client, a ROS node, or a BlueZero node (will be available in V-REP 3.5.0, to be released within 1-3 days).
Cheers
the best for that is to use a customization script, that will adjust various parameters when simulation is not running, and that will listen to some signal or other trigger to start and stop a simulation. That customization script could also interact with a remote API client, a ROS node, or a BlueZero node (will be available in V-REP 3.5.0, to be released within 1-3 days).
Cheers
-
- Posts: 19
- Joined: 31 Aug 2017, 02:11
Re: how to run simulations circularly and automatically
Hi,
Thank you for your quick reply!
Do we have any examples about customization scripts that I can refer to?
Thank you for your quick reply!
Do we have any examples about customization scripts that I can refer to?
Re: how to run simulations circularly and automatically
Have a look at the following models for instance:
- Models/tools/rosInterface helper tool.ttm
- Models/tools/simulation stepper tool.ttm
-
- Posts: 19
- Joined: 31 Aug 2017, 02:11
Re: how to run simulations circularly and automatically
Hi,
Though have read the rosInterface helper tool.ttl, I still have no idea how to write customization script interface with Python.
And I am wondering if you've misunderstanding what I mean, I think it's better to write code in Python API to make simulation keep running circularly and change parameters to find the optimum.
Thanks
Though have read the rosInterface helper tool.ttl, I still have no idea how to write customization script interface with Python.
And I am wondering if you've misunderstanding what I mean, I think it's better to write code in Python API to make simulation keep running circularly and change parameters to find the optimum.
Thanks
Re: how to run simulations circularly and automatically
What I meant to say:
From Python (or in general from an external application) you are much more limited in what you are able to do. But you don't have that limitation from a script running in V-REP. For that reason it is often a good idea to handle the more complex things from within a script, and have the external application just trigger specific routines or behaviours in the script.
Basically, a script can run hand-in-hand with an external application, whether it is a remote API client, a ROS node, or a BlueZero node.
Cheers
From Python (or in general from an external application) you are much more limited in what you are able to do. But you don't have that limitation from a script running in V-REP. For that reason it is often a good idea to handle the more complex things from within a script, and have the external application just trigger specific routines or behaviours in the script.
Basically, a script can run hand-in-hand with an external application, whether it is a remote API client, a ROS node, or a BlueZero node.
Cheers
-
- Posts: 19
- Joined: 31 Aug 2017, 02:11
Re: how to run simulations circularly and automatically
Hi,
Let's make it concretely. Suppose we have two variables , a = [0,10] and b =[1,5], in Python Remote API, we begin simulations when a = 0, b =1, every time when simulation stop , a and b should both plus one , a = 1 and b = 2, and then simulation start again.
So how could I change the value of a and b in the customization script, some sample code would be the best.
And I'm also wondering if there have any method to save data(such as the torque of joint) automatically, rather than by export the graph into CSV by hand
Thanks in advance!
Let's make it concretely. Suppose we have two variables , a = [0,10] and b =[1,5], in Python Remote API, we begin simulations when a = 0, b =1, every time when simulation stop , a and b should both plus one , a = 1 and b = 2, and then simulation start again.
So how could I change the value of a and b in the customization script, some sample code would be the best.
And I'm also wondering if there have any method to save data(such as the torque of joint) automatically, rather than by export the graph into CSV by hand
Thanks in advance!
Re: how to run simulations circularly and automatically
If you run in synchronous mode, then you'll be triggering each simulation step from your remote API client. Then, inside of your customization script, in a sensing section, i.e.:
you could be incrementing your values. sysCall_sensing() is called exactly once for each simulation step.
To say data, best is to do that yourself inside of a child script or customization script: you'll simply have to open a file, and write data to that file, then close that file at the end of a simulation.
Cheers
Code: Select all
function sysCall_sensing()
a=a+1
b=b+1
end
To say data, best is to do that yourself inside of a child script or customization script: you'll simply have to open a file, and write data to that file, then close that file at the end of a simulation.
Cheers