Ubiquity robot shutdown automatically

Hi, I am Howard Choi I am trying to raspberry pi with ubiquity robot however I have a serious problem wih error which raspi is shutdown automatically when I use ros such as rospy with GPIO setup.
here is code : I use ir sensor(obstacle avoidance sensor)

but When I connected monitor it is NOT shutdown but in screen there is poped up shutddown ui.

#!/usr/bin/env python
import rospy
import time
import RPi.GPIO as GPIO
from sensor_msgs.msg import JointState

def exec_sensor():

rate = rospy.Rate(10)

while not rospy.is_shutdown():
    
    if not GPIO.input(boom_lt_er):
        
        rospy.loginfo("boom Left errors")
        
    elif not GPIO.input(boom_rt_er):
        
        rospy.loginfo("boom Right errors")
        
    else:pass
    
    
    
    rate.sleep()

def call_relay():

pass

if name == “main”:

rospy.init_node("u_177_test_relay_on_off")

pub_error = rospy.Publisher("/sensor_indicator", JointState, queue_size=1) 

rospy.Subscriber("/relay_control",JointState, call_relay)   
 
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

"""
these relays use 5v in raspberry pi

"""


boom = 23
roller = 6
mainsail = 13

GPIO.setup(boom, GPIO.OUT)
GPIO.setup(roller, GPIO.OUT)
GPIO.setup(mainsail, GPIO.OUT)


"""
these sensors use 3.3v in raspberry pi

"""

boom_lt_er = 20
boom_rt_er = 21

GPIO.setup(boom_lt_er, GPIO.IN)
GPIO.setup(boom_rt_er, GPIO.IN)

roller_lt_er = 16
roller_rt_er = 12

GPIO.setup(roller_lt_er, GPIO.IN)
GPIO.setup(roller_rt_er, GPIO.IN)

exec_sensor()

rospy.spin()
  
GPIO.cleanup()

Hello Howard,
My thought is this is about usage of GPIO 6. We use GPIO 6 as a shutdown switch.

Please look at this document and it will help you decide which GPIO pins to use and if you need to disable some of the features of Magni (or our image in general).
I am sure you can do your project but just may have to use other GPIO lines

If you do not have our Sonar board then we show on the above page how to disable usage of the Sonar GPIO lines and that is 10 lines that would be free to use without sonar board.

Other unused lines are also in a table on that page.

I hope this helps sort of the issue.
Mark

1 Like

Thanks alot!, I really appreciate it for you. Now it is not shutdown automatically. I work good thanks

Awesome. Thanks for the feedback that your issue is resolved.
Enjoy your project, robots are so cool.