Skip to content
This repository was archived by the owner on Sep 4, 2022. It is now read-only.

Owr usb reset#136

Open
ecl1ipse wants to merge 6 commits intomasterfrom
owr_usb_reset
Open

Owr usb reset#136
ecl1ipse wants to merge 6 commits intomasterfrom
owr_usb_reset

Conversation

@ecl1ipse
Copy link

@ecl1ipse ecl1ipse commented Jun 1, 2019

Backend system that when it receives a message for a frontend node, resets a given usb device

@ecl1ipse ecl1ipse requested review from hjed and wmpmiles June 1, 2019 04:15
Copy link
Contributor

@hjed hjed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good. Feedback around style and process.

Can you please also include the source code for rover/usb_reset.

<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>TODO</license>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update these (MIT and info@bluesat.com.au + your info if you want)

@@ -0,0 +1,63 @@
#!/usr/bin/env python
# license removed for brevity
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please include it - and the other stuff from the standard header format


"""in visudo, need to add %ros ALL = NOPASSWD: /home/ros/owr_software/rover/src/owr_usb_reset/usb_reset
after %sudo ALL=(ALL:ALL) ALL. This allows the usb reset program to run without needing a password for
sudo. Eneter password manually while running causes a problem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you check there is not a group that gives this access by default?
If not can you put this setup into a bash script so its easier to setup (put it in the rover/system folder)

print(devs[data.data])
filepath = "/dev/bus/usb/" + devs[data.data][4:7]
filepath = filepath + "/" + devs[data.data][15:18]
print(filepath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use rospy.loginfo logging rather than prints (this allows us to view and controls logs from the ros console)

print("Out of range")

def listener():
rospy.init_node('usb_reset', anonymous=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should only need to call rospy.init_node once


def listener():
rospy.init_node('usb_reset', anonymous=True)
rospy.Subscriber("rover/usb/reset", Int16, callback)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

topic name needs to start with /

rate = rospy.Rate(1) # 1hz

while not rospy.is_shutdown():
subprocess.call("cd /dev/bus/usb",shell=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to cd here - just run the other command

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants