Recommendations on getting started with VREP/Arduino

Typically: "How do I... ", "How can I... " questions
dnahar
Posts: 30
Joined: 07 Jan 2016, 03:03

Recommendations on getting started with VREP/Arduino

Post by dnahar » 07 Jan 2016, 19:26

Hello,

I am excited to start my exploration on my robot using vrep. I am posting my requirements and asking for recommendations on how to achieve them:

1. I have done coding in Arduino IDE to work with my real robot. What is the best way to use the same code to work with its simulation in vrep. (I need to stick with C++ coding all the time and simulation should be real time, minimum lag)
2. Can i use the vrep's features of path planning, inverse kinematics, collision detection by coding in arduino ide(i.e. using the same setup, coding in arduino ide and simulating in vrep).
3. What is the best way to model my robot(it is a long thin continuum robot hanging on a frame)
(Till now I have VREP EDU and Arduino IDE, let me know for any other installation)
Last edited by dnahar on 04 Feb 2016, 02:49, edited 1 time in total.

marek_g
Posts: 10
Joined: 23 Dec 2015, 12:42

Re: Recommendations on started to work with VREP

Post by marek_g » 07 Jan 2016, 22:00

As far as I know - for now - there is no way to reuse code from Arduino. This code is designated to Arduino and I do not think we may expect V-REP to support it (anyway, how?).

As I understand, you want to write one controller and run it on V-REP and on your robot, simultaneously, without changes. The only way I can imagine to achieve that is to use ROS (there is an option to communicate with Arduino, but this is not a matter of V-REP, rather than architecture of software in your robot).

You can model your robot in any program, that allows to export model in STL format, and then import it into V-REP. Obviously, you can build your robot internally in V-REP from avaialbe shapes.

dnahar
Posts: 30
Joined: 07 Jan 2016, 03:03

Re: Recommendations on started to work with VREP

Post by dnahar » 09 Jan 2016, 19:39

Hello,

Thanks for the response.

1. Ok, so if i cant reuse the code in arduino ide and i want to write code in C++, what could you suggest me specifically?

2. Yes, you got it correct but we wont be using ROS, kindly suggest me another tool.

3. What would you suggest specifically for tendril(long thin) robots to be modelled?

Thanks,
Dixit

marek_g
Posts: 10
Joined: 23 Dec 2015, 12:42

Re: Recommendations on started to work with VREP

Post by marek_g » 10 Jan 2016, 19:54

dnahar wrote: 1. Ok, so if i cant reuse the code in arduino ide and i want to write code in C++, what could you suggest me specifically?
2. Yes, you got it correct but we wont be using ROS, kindly suggest me another tool.
If ROS is not an option, I don't know if any other option exists.

coppelia
Site Admin
Posts: 7199
Joined: 14 Dec 2012, 00:25

Re: Recommendations on started to work with VREP

Post by coppelia » 11 Jan 2016, 10:48

Hello,

what you can do is program everything in c/c++ on your Arduino, and have it connected to V-REP via the remote API. This way you could alternately have your code control the real or the virtual robot. In a very similar way as you would do with ROS.

To model your robot, you can either import a mesh, or create primitive shapes via [Menu bar --> Add --> primitive shape --> ...]. Make sure you read this page.

Cheers

dnahar
Posts: 30
Joined: 07 Jan 2016, 03:03

Re: Recommendations on started to work with VREP

Post by dnahar » 12 Jan 2016, 16:17

Hello,

This helps enormously. So, to confirm for developing a single controller, I need to :

1. Do usual coding in Arduino IDE to control real robot.
2. Create the environment and robot simulation model in VREP.
3. Set up Remote API interface between VREP and Arduino IDE to control the simulation in VREP using same code of Arduino IDE.

Thanks,
Dixit

Eric
Posts: 186
Joined: 11 Feb 2013, 16:39

Re: Recommendations on started to work with VREP

Post by Eric » 13 Jan 2016, 00:17

Hi!

Using the remoteAPI with the arduino might be difficult! I would suggest to use instead the serial port to make your arduino code communicate with V-REP like it is done in the arduino esplora model...

Where your arduino code is supposed to actuate the motors or read sensors of your real robot you can send/read the serial port of the arduino toward/from V-REP following your own protocol of communication.

There is a very simple video tutorial to be able to do just that here: here

Cheers

Eric

dnahar
Posts: 30
Joined: 07 Jan 2016, 03:03

Re: Recommendations on started to work with VREP

Post by dnahar » 13 Jan 2016, 00:31

I understand!

Thanks Eric.

coppelia
Site Admin
Posts: 7199
Joined: 14 Dec 2012, 00:25

Re: Recommendations on started to work with VREP

Post by coppelia » 14 Jan 2016, 10:15

Oops, yes, if your Arduino doesn't have an ethernet module, you can't use the remote API.

Cheers

dnahar
Posts: 30
Joined: 07 Jan 2016, 03:03

Re: Recommendations on started to work with VREP

Post by dnahar » 04 Feb 2016, 02:48

Hello,

We are using Arduino AtMega 2560 which does have ethernet module. We can also use serial port communication which looks easier.

I have further questions:

1. I currently use the serial communication already to send commands to real robot to function using Arduino IDE GUI or Visual Micro GUI. Is it possible to use the same GUI to communicate with the Simulation in VREP too or should i use VREP custom GUI?

2. On receiving Serial Communication in VREP, do I have to write code(mathematical model) in VREP on how to move the simulated robot OR does it determine itself what motor has been asked to run and so on.

Thanks,
Dixit

Post Reply