CentralIllinoisRoboticsClub / wheele

Wheele Navigation ROS robot
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

Autolaunch ROS at power-on #31

Closed mattp256 closed 3 years ago

mattp256 commented 3 years ago

Adding capability to launch ROS/WheelE automatically at power-on using systemd

CentralIllinoisRoboticsClub/wheele Issue #18

coderkarl commented 3 years ago

We could just add this command before the roslaunch command: sudo ip link set can0 up type can bitrate 500000

That way CAN is setup automatically in the same place and documented here. We can find where I put it and just remove it from there.

coderkarl commented 3 years ago

@MikeDvorsky Can you look at the wheele pi files and figure out which method I used to setup CAN at startup? https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/

mattp256 commented 3 years ago

Testing before merging - yes, agree. Mike and I talked about that too. I can help as necessary.

There does not seem to be a straight forward way to use $username across multiple files unfortunately. I'd propose just changing to circ and rolling with it for now.

For the can0 link, I think it would make more sense to start it up separately from ROS. Shouldn't it be possible to configure that to startup by default without having to run the ip command? There should be something like /etc/sysconfig/network-scripts/ifcfg-can0 and/or /etc/networking/interfaces for this. Would have to poke around a little on the pi but there should be a way to do it.

mattp256 commented 3 years ago

Since Josh suggested adding an install script, I did find a way to set the username (and ros distro) at install time, instead of hard-coding it into the scripts, so the install should be pretty modular now. See latest commit.

MikeDvorsky commented 3 years ago

CAN setup is done from /etc/rc.local

coderkarl commented 3 years ago

For setting up the can0 network via network interfaces, reference: https://www.embeddedpi.com/documentation/isolated-canbus/mypi-industrial-raspberry-pi-can-bus-card-configuration This also explains the changes needed in /boot/config.txt

However, it seems like the shell script using the ip command is sufficient.

mattp256 commented 3 years ago

Made some tweaks during build session but latest commit seems to be working well