Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoppeliaSim Package

This package is used to control the robot in the CoppeliaSim environment using the go_to_point behavior. A random goal pose is generated, and the robot aligns itself toward that point.

The robot first sets its linear velocity to move toward the goal position. Once the goal position is reached, it adjusts its angular position to match the required orientation. If the robot is not stopped, this process continues in a loop by generating a new target destination and pose.

The go_to_point behavior is implemented as a server. The robot can be stopped only when it reaches the goal, and it will restart when a new goal is generated. This process continues in a loop when the robot receives the stop command.


Package Components

Child Script for CoppeliaSim

  • dr20_ros_ctrl: Lua script used to control the DR20 mobile robot from the ROS environment.
  • This script does not use an action server, so when the user sends a stop command, the robot stops only after reaching the target.

Python Nodes

  • go_to_point: Implements a service to drive the robot toward a point in the Gazebo/CoppeliaSim environment.
    It publishes velocity commands on /cmd_vel and reads robot position from /odom.
  • user_interface: Prompts the user to start or stop the robot and calls the service implemented in the finite state machine node.

C++ Nodes

  • position_server: Implements a random position service. It returns random values for x, y, and theta, where x and y are limited between minimum and maximum values.
  • state_machine: Controls the robot behavior by starting or stopping it and by requesting a new goal pose when needed. It sends the goal to the go_to_point action server.

Repository Structure

├── CMakeLists.txt
├── coppeliaros.gif
├── dr20_ros_ctrl_Vrep.ttt
├── index.html
├── launch
│   ├── ros_2.launch
│   ├── ros2_sim.launch
│   └── vrep.launch
├── package.xml
├── scripts
│   ├── go_to_point.py
│   └── user_interface.py
├── src
│   ├── position_service.cpp
│   └── state_machine.cpp
├── srv
│   ├── Command.srv
│   ├── Position.srv
│   └── RandomPosition.srv
└── urdf
    └── my_robot.urdf

Requirements

Before running this package, make sure you have:

  • ROS installed.
  • CoppeliaSim installed.
  • A ROS workspace configured correctly.
  • Required dependencies for the package installed.

How to Run

1. Source the ROS workspace

Open a terminal and source your ROS1 workspace:

source ~/catkin_ws/devel/setup.bash

2. Launch the ROS nodes

Use the provided launch file to start all required nodes:

roslaunch rt2_assignment1 vrep.launch

3. Open CoppeliaSim

In a second terminal, run the following command to open CoppeliaSim:

../CoppeliaSim_Edu_V4_2_0_Ubuntu20_04/.coppeliaSim.sh

4. Run the simulation

Once CoppeliaSim starts, the robot should be controlled by the ROS nodes and begin interacting with the environment.


Notes

  • The robot behaves in a loop by generating new random goal poses.
  • The stop command takes effect after the robot reaches the current target.
  • Make sure the workspace is sourced before launching the simulation.
  • Ensure the launch file paths match your local workspace setup.

Author

Muhammad Malook Bugti

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages