Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup TX2 initialization #356

Closed
wants to merge 26 commits into from
Closed

Conversation

RealWilliamWells
Copy link
Member

@RealWilliamWells RealWilliamWells commented Apr 5, 2020

Assignee Section

Description

Made some code changes and additions to ensure that ROS works properly on the TX2.

  • Modified the systemd services and startup scripts that run on the OBC in order for them to work with the user directories of the TX2.
  • Created a setup script( not tested very much, likely has issues ), to keep track of installed software and to make setting up OBC go more smoothly in the future.

Steps for Testing

  1. Follow the client section of this guide for setting up OpenVPN, in order to be able to connect to the Jetson.( Feel free to leave comments in the document to let me know if my instructions suck )
  2. Run ping nividia to ensure that you are able to communicate with the Jetson.
  3. Ssh into the Jetson by using ssh nvidia@nvidia and the password nvidia( this is also the sudo password ). Add your computer's ip and username to its /etc/hosts file.
  4. Run rosgui and startgui.
  5. Run the ros ping_acknowledgement_client node to test your computer's connection to ros master on the Jetson.
  6. Run rostopic list and rosnode list on the Jetson to view currently subscribed rostopics and running rosnodes.
  7. Open the gui and test run anything else and manually run any other ros packages that you can think of.
  8. Run the setup script in a VM or on another user account and ensure it sets everything up properly. Make the sure the user you run it on is named "Nvidia"! ( VM recommended this will install systemd services! ).

Note:
For some odd reason, the ros nodes use the Jetson's computer name of 'jetson-1422719019290' as its hostname instead of its username, when using the VPN server and ran from the systemd service. Roscore still uses the hostname 'nvidia', which is why you have to assign its ip to both of these hostnames. This behaviour didn't seem to occur when connecting over ethernet.

closes #275

The approval from all software team leads is necessary before merging.

Reviewer Section

Aside from local testing and the General Integration Test it is implied that static analysis should be included in the verification process.

For Pull Requests that do not include code changes, it is not required to perform the tests above.

Comment on lines 9 to 11
. ~/Programming/robotics-prototype/robot/rospackages/devel/setup.bash
. ~/Programming/robotics-prototype/venv/bin/activate
source ~/Programming/robotics-prototype/robot/basestation/config/.bash_aliases
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't you use $REPO for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed


# Install Requirements
pip install -U pip
pip install pyserial
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a reason why pip is installed here and not ran through pip -r requirements?

Also you don't include a version # which could be potentially bad

Copy link
Member Author

Choose a reason for hiding this comment

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

Not all of the python libraries are required, so there's no point to create a requirements.txt file just for one library. I included the version # thanks

@@ -9,7 +9,8 @@ const EMAILS_FILE_NAME = 'emails.txt'
// fallback to default emails if there's and issue with the emails file
const DEFAULT_EMAILS = [
'[email protected]',
'[email protected]'
'[email protected]',
'[email protected]'
Copy link
Collaborator

Choose a reason for hiding this comment

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

lol pls add me

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just so you know, read this code to see how to place the email config file so that more members can be notified

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
HOME="/home/odroid"
HOME="/home/nvidia"
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is it sometimes $USER sometimes nvidia

Copy link
Collaborator

Choose a reason for hiding this comment

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

is this related to what you put in the description?

Copy link
Member Author

Choose a reason for hiding this comment

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

There are apparently issues with using $USER when running it as a systemd service. I'll try to changing it back to see if I can get to work tho

Copy link
Member Author

Choose a reason for hiding this comment

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

Also it isn't related to what I put in the description. The description refers to some weird issue with connecting to ROS over a vpn server which has a workaround.

Copy link
Member Author

Choose a reason for hiding this comment

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

The systemd service doesn't work if $USER is used anywhere because the service has to run under root for some reason. I haven't find a way to fix this yet

User=root
Type=simple
ExecStart=/home/odroid/Programming/robotics-prototype/robot/util/rosRoverStart/runRosRoverStart.sh
ExecStart=/home/nvidia/Programming/robotics-prototype/robot/util/rosRoverStart/runRosRoverStart.sh
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't you be using $USER

Copy link
Member Author

Choose a reason for hiding this comment

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

Won't work cause the systemd service has to run under root for some reason

Copy link
Member

Choose a reason for hiding this comment

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

Thing is, you can change the service to run as non-root but then certain processes later in the pipeline will fail and need to be worked around. Some more digging can be done as to where specifically it messes up, but seeing as we're not going to be switching OBC super often I'd say it's fine to leave this as it is for now. Maybe we can open an issue to investigate this for after this PR is merged.

Copy link
Member

Choose a reason for hiding this comment

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

I can try testing this out again for some investigation 👀 🍷

@RealWilliamWells
Copy link
Member Author

I think Travis failed to download one of the requirements on the first test and failed lmao

@MartensCedric
Copy link
Collaborator

So how can we test this? You provided some steps but is the jetson always on? If not, can we coordinate a testing time? @KoaTheKoala did you ever test this since I know you did some jetson work

@RealWilliamWells
Copy link
Member Author

RealWilliamWells commented May 30, 2020

@MartensCedric We would prob have to coordinate a testing time, unless if @KoaTheKoala runs the jetson 24/7. The setup script I made can be tested in VM to ensure that there's no errors. Although that doesn't guarantee that it would setup everything properly for the Jetson.

@PeterGhimself
Copy link
Member

I would also suggest we should include some teensys into the equation that are running the code for rover/arm/science modules, to at least verify if the comms between the MCUs/OBCs still function.
With this you can try to start listeners in the GUI and see if sending commands "works". Without the real deal, we won't see anything budge, but I think the internal LEDs are programmed to blink accordingly (I can re-verify this claim later today).
As well as hypothetically maybe some kind of loads could be attached to represent wheels, maybe even just smaller but similar type motors (that way we can easily set them up to see if they are rotating correctly, more or less).

@MartensCedric
Copy link
Collaborator

Given that its a pain for anyone remote to test, maybe we could devise a test for Koa to perform, upon success of this test we could merge the PR

Copy link
Member

@PeterGhimself PeterGhimself left a comment

Choose a reason for hiding this comment

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

So for increasing the scope of testing, what can be done is connecting some teensies over USB with Rover/Arm/Science code on them, maybe even an arduino uno with PDS over UART comms, and test that they can communicate appropriately. As well, some usb cameras can be connected and tested.

I remember setting up the dependencies for the node emailer script was a pain, and I'm not seeing any of that setup here so that probably still needs to be accounted for as well as tested.

The changes look good, but really the best way forward for this issue I think would be for me to go visit @KoaTheKoala (since he currently has the jetson) and bring some teensies/cameras, do some further testing and confirm that things look good to merge.



# Install camera stuff, these are not ros package dependecies and not installed with rosdep
sudo apt-get install ros-kinetic-cv-camera ros-kinetic-web-video-server -y
Copy link
Member

Choose a reason for hiding this comment

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

There may be a better way, one that will allow us to remove this line specifically. Not a change request, but just a reminder that we may remove this line based off the outcome of #312

Copy link
Member Author

Choose a reason for hiding this comment

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

Alrighty I will note this, encase there's is a pr that removes this line

Copy link
Member

@PeterGhimself PeterGhimself left a comment

Choose a reason for hiding this comment

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

A few coments upon re-reviewing the code, before running a physical test.


# Install Requirements
pip install -U pip
pip install pyserial==3.4 rospkg==1.1.7
Copy link
Member

Choose a reason for hiding this comment

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

since these are included in requirements.txt perhaps we should just use that? i.e. pip install -r requirements.txt -r requirements-dev.txt for completeness


source ~/.bashrc

sudo apt install ros-kinetic-rosbridge-suite -y
Copy link
Member

Choose a reason for hiding this comment

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

This script needs to be run as sudo? If so maybe we can add a previous check to see if whoami returns root. If not, exit the script with a message saying it needs to be run with sudo.

sudo cp configEthernet/runConfigEthernet.sh /usr/bin/runConfigEthernet.sh
sudo cp emailer/runEmailer.sh /usr/bin/runEmailer.sh
cd $REPO/robot/util/configEthernet && bash synchConfigEthernet.sh
cd $REPO/robot/util/emailer/ && bash syncEmailer.sh
Copy link
Member

Choose a reason for hiding this comment

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

I'd be surprised if the node emailer script worked out of the box. Gonna make sure to test this.

User=root
Type=simple
ExecStart=/home/odroid/Programming/robotics-prototype/robot/util/rosRoverStart/runRosRoverStart.sh
ExecStart=/home/nvidia/Programming/robotics-prototype/robot/util/rosRoverStart/runRosRoverStart.sh
Copy link
Member

Choose a reason for hiding this comment

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

I can try testing this out again for some investigation 👀 🍷

Comment on lines 15 to 18
# Setup venv
cd $REPO

# Setup systemd services
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is useless

@@ -21,4 +21,4 @@ source "$REPO_HOME/venv/bin/activate"
python3 "$REPO_HOME/setup.py" develop

# source primary catkin_ws setup bash script and execute one launch script to rule them all
source $OPT_KINETIC_SETUP && source $ROS_PACKAGES_SETUP && roslaunch $ROSLAUNCH_FILE
source OPT_MELODIC_SETUP && source $ROS_PACKAGES_SETUP && roslaunch $ROSLAUNCH_FILE
Copy link
Collaborator

Choose a reason for hiding this comment

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

dollar sign missing

@MartensCedric
Copy link
Collaborator

We had trouble compiling web_video_server until this was done : RobotWebTools/web_video_server#113

Then two problems with the services

  1. With ros-rover-start, the email doesn't send because it can't find "node" despite node working just fine in the terminal (but it doesnt work from the startup service)

  2. config ethernet also crashes but this is probably just because there's nothing in the ethernet port

Copy link
Collaborator

@MartensCedric MartensCedric left a comment

Choose a reason for hiding this comment

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

Before merging this, the exact steps of the non-automated procedure should be written on a README or a wiki page.

Something that are not quite well documented (they are documented somewhere but not in a central place)

  • install npm
  • services
  • udev
  • webvideoserver edit

@OZiad OZiad deleted the setup-tx2-initialization-275 branch July 20, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup TX2 initialization
4 participants