[Bug] python code error

This is an error report.


Screenshot of the error


Error details

its look like the python code that exists in move_bb8_square has some problem in line 11 as u can see

Hi @parsa07, the issue here is a mistake when the code was copied over from the course notebook to the move_bb8_square.py file.

The error points to an unexpected indent, so check line 11. It should be in line with the previous publisher initialization, like this:

#!/usr/bin/env python
import rospy
from geometry_msgs.msg import Twist
import time
import math

class MoveBB8():
    
    def __init__(self):
        self.bb8_vel_publisher = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
        self.cmd = Twist()
        self.ctrl_c = False
        rospy.on_shutdown(self.shutdownhook)
        self.rate = rospy.Rate(10)

I recommend simply deleting the contents and pasting them again making sure the alignment is correct.

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