Apartment Navigation By Classic Wheeled Robot
Comprehensive Production Grade Repository For Apartment Navigation Project (Inspired By Udacity Course)
 
Loading...
Searching...
No Matches
DriveBotTest Class Reference

Integration tests for the DriveBot ROS 2 service node. More...

Inheritance diagram for DriveBotTest:

Protected Member Functions

void SetUp () override
 Sets up the test environment with DriveBot server and test client.
 
void TearDown () override
 Tears down the test environment.
 
template<typename FutureT>
bool spinUntilComplete (FutureT &future, std::chrono::seconds timeout=std::chrono::seconds(2))
 Spins the executor until a future resolves or timeout elapses.
 

Protected Attributes

std::shared_ptr< robot_control::ball_chaser::DriveBotm_server
 DriveBot service node being tested.
 
std::shared_ptr< rclcpp::Node > m_client
 Test client node.
 
rclcpp::Client< DriveToTarget >::SharedPtr m_requester
 Client to call the DriveToTarget service.
 
rclcpp::executors::SingleThreadedExecutor m_executor
 Executor to spin nodes during tests.
 

Detailed Description

Integration tests for the DriveBot ROS 2 service node.

Tests verify that the DriveBot service:

  • Is properly advertised and discoverable
  • Echoes requested velocities in the response
  • Publishes velocity commands to /cmd_vel topic

Member Function Documentation

◆ SetUp()

void DriveBotTest::SetUp ( )
inlineoverrideprotected

Sets up the test environment with DriveBot server and test client.

Initializes the DriveBot node, a test client node, creates the service requester, and registers both nodes with the executor.

◆ spinUntilComplete()

template<typename FutureT>
bool DriveBotTest::spinUntilComplete ( FutureT & future,
std::chrono::seconds timeout = std::chrono::seconds(2) )
inlineprotected

Spins the executor until a future resolves or timeout elapses.

Template Parameters
FutureTType of the future (deduced).
Parameters
futureFuture to wait for completion.
timeoutMaximum time to wait (default 2 seconds).
Returns
True if the future completed, false if timeout elapsed.

◆ TearDown()

void DriveBotTest::TearDown ( )
inlineoverrideprotected

Tears down the test environment.

Removes both the server and client nodes from the executor for cleanup.


The documentation for this class was generated from the following file: