Grading has taken longer than expected

can anyone help me with this?

Hi @NeelashKannan ,

I can’t give you detailed explanation without seeing your code.

From the output / report generated by the GradeBot, I believe that there is some part in your program that does a infinite loop without breaking out.

I suggest that you go through your program and check if there are any while loops that is running infinitely without having met any end condition.

If you still have issues or need help debugging your program, please post your program here as a code-block.

Regards,
Girish

#!/usr/bin/env python

import rospy
import actionlib
from basics_exam.srv import DistanceMotion
from basics_exam.msg import RecordPoseAction, RecordPoseGoal
from geometry_msgs.msg import Pose

def call_motion_service():
rospy.loginfo(“Waiting for the /dist_motion_service to become available…”)

try:
    # Wait for the service with a timeout (e.g., 10 seconds)
    rospy.wait_for_service('/dist_motion_service', timeout=5)
    motion_service = rospy.ServiceProxy('/dist_motion_service', DistanceMotion)
    response = motion_service()
    rospy.loginfo(f"Motion service response: {response.message}")
except rospy.ROSException as e:
    rospy.logerr(f"Service /dist_motion_service timed out: {e}")
except rospy.ServiceException as e:
    rospy.logerr(f"Service call failed: {e}")

def call_record_pose_action():
rospy.loginfo(“Waiting for the /rec_pose_as action server to become available…”)

# Create action client
client = actionlib.SimpleActionClient('/rec_pose_as', RecordPoseAction)

# Wait for action server to become available (e.g., timeout of 10 seconds)
if not client.wait_for_server(timeout=rospy.Duration(5)):
    rospy.logerr("Action server /rec_pose_as not available after waiting")
    return None

# Create a goal and send it to the action server
goal = RecordPoseGoal()
client.send_goal(goal)

# Wait for the result (e.g., timeout of 30 seconds)
if not client.wait_for_result(timeout=rospy.Duration(10)):
    rospy.logerr("Action /rec_pose_as did not finish within the timeout period")
    return None

# Return the result from the action server
return client.get_result()

if name == ‘main’:
rospy.init_node(‘main_program’)

# Call the motion service
rospy.loginfo("Calling the motion service...")
call_motion_service()

# Call the action server to record poses
rospy.loginfo("Calling the record pose action...")
result = call_record_pose_action()

# Print the last recorded pose
if result and result.poses:
    last_pose = result.poses[-1]
    rospy.loginfo("Last Pose:")
    rospy.loginfo(f"position:\n  x: {last_pose.position.x}\n  y: {last_pose.position.y}\n  z: {last_pose.position.z}")
    rospy.loginfo(f"orientation:\n  x: {last_pose.orientation.x}\n  y: {last_pose.orientation.y}\n  z: {last_pose.orientation.z}\n  w: {last_pose.orientation.w}")
else:
    rospy.logwarn("No poses were recorded.")

this is my code

Hi @NeelashKannan ,

Thanks for sharing your code. Visually inspecting your code, I don’t find any parts in the code that would cause infinite looping or blocking.

I would however like to see the output of this program without running it through GradeBot. Please paste it here as a code-block again.
DO NOT COPY-PASTE AS IS FROM YOUR TERMINAL. PASTE IT HERE AS A CODE-BLOCK!

Also, please fix this program post with the proper format as a markdown code-block. Otherwise it will be quite difficult for us to understand the indentations in your code, specifically in a python program.

Regards,
Girish

okay, I will correct it from next time,

but still i’m getting the same error

Hi @NeelashKannan ,

Regards,
Girish

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.