0% found this document useful (0 votes)
31 views

Simple Code To Control Pioneer P3-Dx With Matlab & Coppeliasim (Old V-Rep)

This document provides steps to control a Pioneer p3-DX robot in CoppeliaSim using MATLAB. It involves setting up the integration files to connect CoppeliaSim and MATLAB, creating a scene with the robot and sensors, and writing scripts to get object handles and control the robot motors and read sensors. Example code is provided to control the robot's movement using different numbers of proximity sensors and turning methods.

Uploaded by

an danh tran
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Simple Code To Control Pioneer P3-Dx With Matlab & Coppeliasim (Old V-Rep)

This document provides steps to control a Pioneer p3-DX robot in CoppeliaSim using MATLAB. It involves setting up the integration files to connect CoppeliaSim and MATLAB, creating a scene with the robot and sensors, and writing scripts to get object handles and control the robot motors and read sensors. Example code is provided to control the robot's movement using different numbers of proximity sensors and turning methods.

Uploaded by

an danh tran
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Simple Code to Control Pioneer p3-DX with

MATLAB & CoppeliaSim (Old V-Rep)

o Step 0: Create New Project File


o Step 1: Add Integration Files for Connect CoppeliaSim to
MATLAB
- Go To CoppeliaSim Installation Path: for Example:
C:\Program Files\CoppeliaRobotics\CoppeliaSimEdu
- Go to “Programming” Folder
- Go to “remoteApiBindings” Folder
- If We Use MATLAB To Control Then Go to “matlab”
Folder and Again Open “matlab” Folder
- Copy 3 Files:
 remApi,m
 remoteApiProto.m
 simpleTest.m
- Paste Them to your Project Folder
- Go Back to “remoteApiBindings” Folder And Go to “lib”
and Again “lib”
- If We Use Windows Go to “Windows” and Copy
“remoteApi.dll” to your Project Folder
o Step 2: Open CoppeliaSim & MATLAB
o Step 3: In CoppeliaSim Create New Scene
o Step 4: Add Pioneer p3-DX Robots to the World
o Step 5: Add a Cuboid to the World
o Step 6: Create a Perspective Vision Sensor and Set
Directions
o Step 7: Create Script File
- In Scene hierarchy Right Click to Cuboid Go to “Add”
Next “Associated child script” Click “Non threaded”
- Write simRemoteApi.start(19999) into
function sysCall_init()
-- do some initialization here
end
o Step 8: Save Scene
o Step 9: Open MATLAB
o Step 10: Add your Project Folder in MATLAB Directory
o Step 11: Connection Test
- Open “simpleTest.m” and Click Run and Go to
CoppeliaSim Software
- If you See Mouse Position in Matlab Command Window
Mean Connection is Done
o Step 12: Back to MATLAB and Create a new Script
o Step 13: Write Some Necessary Code
- Write :
sim=remApi('remoteApi');
sim.simxFinish(-1);
clientID=sim.simxStart('127.0.0.1',19999,true,true,5000,
5);
if (clientID>-1)
disp('connected')
end
sim.delete();
o Step 14 Lets Write Code
- Get Object Handle (Command for Access to Object)
Go to Website Blew and you Can See All Function
Code:
“https://www.coppeliarobotics.com/helpFiles/en/remoteApiFunctionsMatlab.htm”
 Motors
 Set Joint Target Velocity (for Motors)
 Sensors
 Read Proximity Sensor (for Sensors)
- Let’s Exam Two Control Code
 Pioneer1
 Author: Mahdi Hajimohammadi
 Sensor Using: 3
 Turn Method: Reverse Wheel Turning
 Sensor Calibration: Tuning
 Sensibility : Medium
 Pioneer2
 Author: Mahdi Hajimohammadi (Convert
Nikolai K. Pyton code Base to MATLAB code
Base)
 Sensor Using: All 16 Sensor
 Turn Method: Increase or Decrease Left and
Right Wheel’s Velocity
 Sensor Calibration: Tuning
 Sensibility : Hight

You might also like