Ask Your Question

Nvidia Jetson GPIO with ROS

asked 2016-06-26 10:50:26 -0600

jacksonkr_ gravatar image

There are plenty of articles online about the Jetson GPIO but there's not much about using it with ROS.

Is there a simple way to integrate Jetson GPIO with ROS or do you have to control everything manually through your ROS cpp program?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-06-26 13:47:17 -0600

luketheduke gravatar image

You can do it both ways. You can directly access the pins from your program with C++. The other approach is to write a node that uses topics or services to access or set the pins. For reference you can look at these resources from the wiki:

Writing a Simple Service and Client (C++))

Writing a Simple Publisher and Subscriber (C++))

I don't know how you are managing permissions on your robot, but for me to access GPIO on my Beaglebone, I just made sudo passwordless and then when my node launched, I chmodded the /dev/class/gpio folder to allow my user to access it. Hope this helps! luketheduke

edit flag offensive delete link more



Great info! I'm glad you brought up permissions. I think I'll take your passwordless sudo approach. I have wifi / ssh on this machine but sudo won't apply unless someone is logged in so I should be good.

jacksonkr_ gravatar image jacksonkr_  ( 2016-06-26 14:14:17 -0600 )edit

Also, another thing to note is that if you are using the robot_upstart package to launch your nodes on boot, then you want to modify the source code for it to use sudo -u USERNAME instead of the setuid that it uses itself. In the unmodified state, robot_upstart doesn't play nice with GPIO.

luketheduke gravatar image luketheduke  ( 2016-06-26 14:33:31 -0600 )edit

If this answer answers your question, please mark it solved by pressing the button below the upvote/downvote buttons. This helps improve the ROS community. Thanks, luketheduke

luketheduke gravatar image luketheduke  ( 2016-06-26 14:35:17 -0600 )edit

Is there an include statement for GPIO in C++? Like #include /jetson/gpio

CoachAllen gravatar image CoachAllen  ( 2020-01-15 01:13:03 -0600 )edit

There are several different approaches to controlling GPIO with the Jetson. Because C++ is such a low level language here is the recommended approach from the Nvidia forums: You can also try this library:

luketheduke gravatar image luketheduke  ( 2020-01-15 09:17:38 -0600 )edit

So you would merely make the gpio availble to any package calling it?

CoachAllen gravatar image CoachAllen  ( 2020-01-26 18:14:49 -0600 )edit

It depends on what approach you want to take, you could either integrate GPIO into every package that needed it or make one package that handles all GPIO and communicates over a topic/service.

luketheduke gravatar image luketheduke  ( 2020-04-20 19:25:44 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-06-26 10:50:26 -0600

Seen: 896 times

Last updated: Jun 26 '16