Controlling a Robot using Java.

Typically: "How do I... ", "How can I... " questions
Litterio
Posts: 8
Joined: 28 Apr 2016, 19:22

Controlling a Robot using Java.

Postby Litterio » 07 May 2017, 00:39

Hello there!

I'd like to give commands to a robot using java's remote api in V-rep.

I already know how to start a comunication between v-rep and java.

Is it possible to have some basic examples on how to give commands to a robot, for example how to move a robot's arm or how to move forward the youbot, using Java's remote Api?

Unfortunatly, the examples on the programming/remoteApiBindigs didn't help me so much.

Thank you for your help.

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

Re: Controlling a Robot using Java.

Postby coppelia » 08 May 2017, 06:04

Hello,

the best would be to send from Java only high-level commands, since you always have the communication delay overhead, and because the remote API doesn't directly support all regular API functions.

Best would probably to use mainly simxCallScriptFunction from your remote API client, and handle all the details in a simulation script.

Cheers

Litterio
Posts: 8
Joined: 28 Apr 2016, 19:22

Re: Controlling a Robot using Java.

Postby Litterio » 12 May 2017, 11:08

coppelia wrote:Hello,

the best would be to send from Java only high-level commands, since you always have the communication delay overhead, and because the remote API doesn't directly support all regular API functions.

Best would probably to use mainly simxCallScriptFunction from your remote API client, and handle all the details in a simulation script.

Cheers



Hello, thank you for your reply.

Can I do the same using simxSetStringSignal(in java) and simGetStringSignal(lua script)?

So, for example, using the simxSetStringSignal I'll send(from my java client) a signal to vrep allowing him to move the robot's arm. If the signal is not received vrep won't move anything.

Could it work or it's only a waste of time?

Thank you :)

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

Re: Controlling a Robot using Java.

Postby coppelia » 15 May 2017, 15:27

That would also work. It is not that elegant, but works too. Once you have received a signal on the V-REP side, you will have to erase it directly after processing the corresponding command.

Cheers

Litterio
Posts: 8
Joined: 28 Apr 2016, 19:22

Re: Controlling a Robot using Java.

Postby Litterio » 15 May 2017, 17:00

THanks again for the reply.

I'm so sorry but I've now another problem :(

The java function simxSetStringSignal uses charWA signal and not a string signal (like matlab, for example). How can I translate a charWA into a string in lua script? Or how can I send a signal without using a charWA variable?



Thank you very much.

Litterio
Posts: 8
Joined: 28 Apr 2016, 19:22

Re: Controlling a Robot using Java.

Postby Litterio » 15 May 2017, 17:18

Litterio wrote:THanks again for the reply.

I'm so sorry but I've now another problem :(

The java function simxSetStringSignal uses charWA signal and not a string signal (like matlab, for example). How can I translate a charWA into a string in lua script? Or how can I send a signal without using a charWA variable?



Thank you very much.


lol my bad, there was a huge mistake in my code but I thought the program didn't work because of the charWA.

Now the problem is solved and I can move my robot using signals. It works fine.

Thanks again coppelia.


Return to “General questions”

Who is online

Users browsing this forum: No registered users and 21 guests