bug_as module
- bug_as.change_state(state)[source]
Updates the robot’s navigation state and adjusts service calls accordingly.
Parameters: state (int):
The new state to transition to (0: go to point, 1: wall following, 2: done).
- bug_as.clbk_laser(msg)[source]
Callback function for the laser scanner subscriber.
Processes laser scan data and segments obstacle distances into predefined regions.
Parameters: msg (sensor_msgs.msg.LaserScan):
The laser scan message containing range data.
- bug_as.clbk_odom(msg)[source]
Callback function for the odometry subscriber.
Updates the robot’s position and yaw angle based on odometry data.
Parameters: msg (nav_msgs.msg.Odometry):
The odometry message containing the robot’s pose.
- bug_as.main()[source]
Initializes the ROS node, sets up subscribers, publishers, and services, and starts the action server.
- bug_as.normalize_angle(angle)[source]
Normalizes an angle to the range [-pi, pi].
Parameters: angle (float):
The angle in radians.
Returns: angle (float):
The normalized angle.
- bug_as.planning(goal)[source]
Executes the robot’s goal-reaching behavior while avoiding obstacles.
Parameters: goal (assignment_2_2024.msg.PlanningGoal):
The goal message containing the target pose.
- bug_as.state_ = 0
Current navigation state (0 - go to point, 1 - wall following, 2 - done, 3 - canceled)