Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

invoke rostopic (remote control) from a web page button

I'm working on getting remote control of a Roomba via web page running.

I have made some progress by installing Apache and PHP on the Roomba laptop and was able to basically make it a web server that serves up a page to the internet. However, I ran into a problem and I can't find a way around it.  I'm hoping someone has a suggestion.

I created a php page that calls a shell script called "forward.sh":

#!/bin/bash
/opt/ros/diamondback/ros/bin/rostopic pub /cmd_vel geometry_msgs/Twist -r 20
'[-0.1,-0.1,-0.1]' '[0,0,0]'
sleep 2
/opt/ros/diamondback/ros/bin/rostopic pub /cmd_vel geometry_msgs/Twist -r 20
'[0,0,0]' '[0,0,0]'
echo "<p> This is just a test </p>"

This shell script works when I launch it from command line, however, when I call the shell script (forward.sh) from the php page (run.php), it appears to call the script because the sleep command and the echo command in the forward.sh seem to work, however, the roomba does not receive the rostopic commands:

<h3>Executing Roomba Forward.sh</h3>
<?php
echo shell_exec('/usr/lib/cgi-bin/forward.sh');
# echo shell_exec('sudo -u kevin /usr/lib/cgi-bin/forward.sh <
/home/kevin/passwordfile');
?>
<p> This is after the shell script runs </p>

The forward.sh script works. The Roomba moves forward... It never breaks out of the first rostopic command but I realize that is a separate issue. However, the rostopic commands do not work when the shell script is launched when the php file loads.... Interestingly, the "This is just a test" message shows up on the page and increasing the sleep time increases the load time of the page.

Any thoughts?

invoke rostopic (remote control) from a web page button

I'm working on getting remote control of a Roomba via web page running.

I have made some progress by installing Apache and PHP on the Roomba laptop and was able to basically make it a web server that serves up a page to the internet. However, I ran into a problem and I can't find a way around it.  I'm hoping someone has a suggestion.

I created a php page that calls a shell script called "forward.sh":

#!/bin/bash
/opt/ros/diamondback/ros/bin/rostopic pub /cmd_vel geometry_msgs/Twist -r 20
'[-0.1,-0.1,-0.1]' '[0,0,0]'
sleep 2
/opt/ros/diamondback/ros/bin/rostopic pub /cmd_vel geometry_msgs/Twist -r 20
'[0,0,0]' '[0,0,0]'
echo "<p> This is just a test </p>"

This shell script works when I launch it from command line, however, when I call the shell script (forward.sh) from the php page (run.php), it appears to call the script because the sleep command and the echo command in the forward.sh seem to work, however, the roomba does not receive the rostopic commands:

<h3>Executing Roomba Forward.sh</h3>
<?php
echo shell_exec('/usr/lib/cgi-bin/forward.sh');
# echo shell_exec('sudo -u kevin /usr/lib/cgi-bin/forward.sh <
/home/kevin/passwordfile');
?>
<p> This is after the shell script runs </p>

The forward.sh script works. The Roomba moves forward... It never breaks out of the first rostopic command but I realize that is a separate issue. However, the rostopic commands do not work when the shell script is launched when the php file loads.... Interestingly, the "This is just a test" message shows up on the page and increasing the sleep time increases the load time of the page.

Any thoughts?

invoke rostopic (remote control) from a web page button

I'm working on getting remote control of a Roomba via web page running.

I have made some progress by installing Apache and PHP on the Roomba laptop and was able to basically make it a web server that serves up a page to the internet. However, I ran into a problem and I can't find a way around it.  I'm hoping someone has a suggestion.

I created a php page that calls a shell script called "forward.sh":

#!/bin/bash
/opt/ros/diamondback/ros/bin/rostopic pub /cmd_vel geometry_msgs/Twist -r 20
'[-0.1,-0.1,-0.1]' '[0,0,0]'
sleep 2
/opt/ros/diamondback/ros/bin/rostopic pub /cmd_vel geometry_msgs/Twist -r 20
'[0,0,0]' '[0,0,0]'
echo "<p> This is just a test </p>"

This shell script works when I launch it from command line, however, when I call the shell script (forward.sh) from the php page (run.php), it appears to call the script because the sleep command and the echo command in the forward.sh seem to work, however, the roomba does not receive the rostopic commands:

<h3>Executing Roomba Forward.sh</h3>
<?php
echo shell_exec('/usr/lib/cgi-bin/forward.sh');
# echo shell_exec('sudo -u kevin /usr/lib/cgi-bin/forward.sh <
/home/kevin/passwordfile');
?>
<p> This is after the shell script runs </p>

The forward.sh script works. The Roomba moves forward... It never breaks out of the first rostopic command but I realize that is a separate issue. However, the rostopic commands do not work when the shell script is launched when the php file loads.... Interestingly, the "This is just a test" message shows up on the page and increasing the sleep time increases the load time of the page.

Any thoughts?