Skip to content

ROS2 workspace including a custom service file and a service client package to manage data from a 3 DOF sensor.

Notifications You must be signed in to change notification settings

jessicaanz/Machina_Robotics_HW

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 

Repository files navigation

Robotic Homework Solution

Introduction

The goal of this project was to build a ROS2 network that will handle data from a 3 degree of freedom (3 DOF) sensor. A simple sensor simulator from the provided sensor.py file was used to generate random data mimicking a real sensor. The project's solution uses a service and client package to manage the data. The service reads data from 2 variations of the simulated sensor, and sends that data to the client. The client connects to the server to obtain sensor data and publishes it to a topic. The topic is then subscribed to in order to print the topic on the command line. The resulting output is xyz data for each sensor being printed on the client’s command line at a rate of 500 Hz.

Installation and Usage

To use this repository, ROS2 should be installed (the Humble distribution was used to develop this code). With ROS2 installed, follow these steps to implement the repository:

  1. Clone the repository by running the following command in a terminal
    git clone https://github.com/jessicaanz/Machina_Robotics_HW.git
    
  2. Navigate to the ‘ros2_ws’ directory, check for missing dependencies, and build the workspace
    cd ros2_ws
    rosdep install -i --from-path src --rosdistro humble -y
    colcon build
    
  3. Open a new terminal, navigate to the workspace, and source the setup files
    cd ros2_ws
    source install/setup.bash
    
  4. Run the service node
    ros2 run sensor_data service
    
  5. Open another terminal, navigate to the workspace, and source the setup files (repeat step 3)
  6. Run the client node
    ros2 run sensor_data client
    

The client node should now print data for each sensor to the command line, as shown below:

Sensor 1: array('d', [0.3787783585084664, 0.6895387732413033, 0.8848552216641941])
Sensor 2: array('d', [0.5387855777673284, 0.8236174288867347, 0.46963570027992874])

Chosen Number of Samples

Calls to the sensors should be published at a rate of 500 Hz, which means each call should take 2 ms total. The first sensor has a 2000 Hz sampling rate and a 1 ms delay. This sensor takes 0.5ms per sample, plus the 1 ms delay time. Therefore, 2 samples should be taken for sensor 1 so that the total call time is the desired 2 ms. The second sensor has a 4000 Hz sampling rate and a 1 ms delay. This sensor takes 0.25ms per sample, plus the 1 ms delay. Therefore, 4 samples should be taken for sensor 2 to achieve the desired 2 ms call time.

Sources

About

ROS2 workspace including a custom service file and a service client package to manage data from a 3 DOF sensor.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published