-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from chameau5050/ros2
Update gif250 to gro525
- Loading branch information
Showing
2 changed files
with
172 additions
and
174 deletions.
There are no files selected for viewing
96 changes: 47 additions & 49 deletions
96
racecar_bringup/launch/gif250.launch.py → racecar_bringup/launch/gro525.launch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,47 @@ | ||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, SetLaunchConfiguration | ||
from launch_ros.actions import Node | ||
from launch.actions import IncludeLaunchDescription | ||
from launch_xml.launch_description_sources import XMLLaunchDescriptionSource | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
from ament_index_python.packages import get_package_share_directory | ||
|
||
def generate_launch_description(): | ||
# Get the package directories | ||
rosbridge_server_pkg_share_dir = get_package_share_directory('rosbridge_server') | ||
web_video_server_pkg_share_dir = get_package_share_directory('web_video_server') | ||
racecar_web_interface_pkg_share_dir = get_package_share_directory('racecar_web_interface') | ||
|
||
port_argument = DeclareLaunchArgument( | ||
'port', default_value='9090', | ||
description='Port for rosbridge websocket' | ||
) | ||
|
||
|
||
# Launch rosbridge_websocket_launch.xml from rosbridge_server package | ||
rosbridge_launch = IncludeLaunchDescription( | ||
XMLLaunchDescriptionSource([rosbridge_server_pkg_share_dir, '/launch/rosbridge_websocket_launch.xml']), | ||
launch_arguments={'port': '9090'}.items() | ||
) | ||
|
||
#Launch web_video_server node from web_video_server package | ||
web_video_server_node = Node( | ||
package='web_video_server', | ||
executable='web_video_server', | ||
name='web_video_server', | ||
output='screen', | ||
parameters=[{'address': '10.42.0.1'}] # Set the address parameter to "10.42.0.1" | ||
) | ||
|
||
# Launch ros2_publisher_camera node from racecar_web_interface package | ||
ros2_publisher_camera_node = Node( | ||
package='racecar_web_interface', | ||
executable='ros2_publisher_camera', | ||
name='ros2_publisher_camera', | ||
output='screen' | ||
) | ||
|
||
return LaunchDescription([ | ||
port_argument, | ||
rosbridge_launch, | ||
web_video_server_node, | ||
ros2_publisher_camera_node | ||
]) | ||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument, SetLaunchConfiguration | ||
from launch_ros.actions import Node | ||
from launch.actions import IncludeLaunchDescription | ||
from launch_xml.launch_description_sources import XMLLaunchDescriptionSource | ||
from launch.launch_description_sources import PythonLaunchDescriptionSource | ||
from ament_index_python.packages import get_package_share_directory | ||
|
||
def generate_launch_description(): | ||
# Get the package directories | ||
rosbridge_server_pkg_share_dir = get_package_share_directory('rosbridge_server') | ||
web_video_server_pkg_share_dir = get_package_share_directory('web_video_server') | ||
racecar_web_interface_pkg_share_dir = get_package_share_directory('racecar_web_interface') | ||
racecar_bringup_pkg_share_dir = get_package_share_directory('racecar_bringup') | ||
|
||
port_argument = DeclareLaunchArgument( | ||
'port', default_value='9090', | ||
description='Port for rosbridge websocket' | ||
) | ||
|
||
|
||
# Launch rosbridge_websocket_launch.xml from rosbridge_server package | ||
bringup_launch = IncludeLaunchDescription( | ||
PythonLaunchDescriptionSource([racecar_bringup_pkg_share_dir, '/launch/bringup.launch.py']) | ||
) | ||
|
||
# Launch rosbridge_websocket_launch.xml from rosbridge_server package | ||
rosbridge_launch = IncludeLaunchDescription( | ||
XMLLaunchDescriptionSource([rosbridge_server_pkg_share_dir, '/launch/rosbridge_websocket_launch.xml']), | ||
launch_arguments={'port': '9090'}.items() | ||
) | ||
|
||
#Launch web_video_server node from web_video_server package | ||
web_video_server_node = Node( | ||
package='web_video_server', | ||
executable='web_video_server', | ||
name='web_video_server', | ||
output='screen', | ||
parameters=[{'address': '10.42.0.1'}] # Set the address parameter to "10.42.0.1" | ||
) | ||
|
||
return LaunchDescription([ | ||
bringup_launch, | ||
port_argument, | ||
rosbridge_launch, | ||
web_video_server_node, | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,125 +1,125 @@ | ||
<!doctype html> | ||
<html> | ||
<!-- | ||
==References== | ||
Server-side: | ||
* http://docs.ros.org/indigo/api/roswww/html/ | ||
* http://wiki.ros.org/web_video_server | ||
* http://wiki.ros.org/rosbridge_suite/Tutorials/RunningRosbridge | ||
Client-side: | ||
* http://wiki.ros.org/roslibjs/Tutorials/BasicRosFunctionality | ||
* https://getbootstrap.com/docs/4.0/getting-started/introduction/ | ||
* https://getbootstrap.com/docs/4.0/layout/grid/ | ||
* https://github.com/jeromeetienne/virtualjoystick.js | ||
--> | ||
|
||
<head> | ||
<!-- Required meta tags --> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
|
||
<!-- Bootstrap CSS --> | ||
<link rel="stylesheet" href="css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="css/dashboard.css"> | ||
|
||
<title>Laboratoire S5-GIF250</title> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<!-- Menu BEGIN--> | ||
<div class="collapse" id="navbarToggleExternalContent"> | ||
<div class="bg-dark p-4"> | ||
<h6 class="text-white h4">Configuration</h6> | ||
</div> | ||
</div> | ||
|
||
<nav class="navbar navbar-dark bg-dark"> | ||
<div> | ||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
</div> | ||
</nav> | ||
<!-- Menu END--> | ||
|
||
<!-- Main layout BEGIN--> | ||
<div class="container-fluid"> | ||
|
||
</div> | ||
|
||
<!-- JavaScript, import frameworks --> | ||
<!-- jQuery first, then Popper.js, then Bootstrap JS --> | ||
<script src="js/jquery-3.3.1.slim.min.js"></script> | ||
<script src="js/popper.min.js"></script> | ||
<script src="js/bootstrap.min.js"></script> | ||
<script src="js/virtualjoystick.js"></script> | ||
<script src="js/roslib.min.js"></script> <!-- rosbridge --> | ||
|
||
<!-- Custom scripts --> | ||
<script> | ||
// Define some global variables | ||
var rbServer = null; | ||
var cmdVelTopic = null; | ||
|
||
//Some initializations after the page has been shown | ||
$(document).ready(function(){ | ||
document.getElementById("log").value = 'Default text\n' | ||
}); | ||
|
||
// Define some functions | ||
function connectROS() { | ||
|
||
// This function connects to the rosbridge server running on the local computer on port 9090 | ||
rbServer = new ROSLIB.Ros({ | ||
url : 'ws://' + rosMasterIp + ':9090' | ||
}); | ||
|
||
rbServer.on('connection', function() { | ||
console.log('Connected to websocket server.'); | ||
|
||
// These lines create a topic object as defined by roslibjs | ||
cmdVelTopic = new ROSLIB.Topic({ | ||
ros : rbServer, | ||
name : '/racecar/cmd_vel_abtr_2', | ||
messageType : 'geometry_msgs/Twist' | ||
}); | ||
}); | ||
|
||
rbServer.on('error', function(error) { | ||
console.log('Error connecting to websocket server: ', error); | ||
}); | ||
|
||
rbServer.on('close', function() { | ||
console.log('Connection to websocket server closed.'); | ||
}); | ||
} | ||
|
||
|
||
// These lines create a message that conforms to the structure of the Twist defined in our ROS installation | ||
// It initalizes all properties to zero. They will be set to appropriate values before we publish this message. | ||
var twist = new ROSLIB.Message({ | ||
linear : { | ||
x : 0.0, | ||
y : 0.0, | ||
z : 0.0 | ||
}, | ||
angular : { | ||
x : 0.0, | ||
y : 0.0, | ||
z : 0.0 | ||
} | ||
}); | ||
|
||
setInterval(function(){ | ||
if(cmdVelTopic != null) { | ||
// Publish the message | ||
cmdVelTopic.publish(twist); | ||
} | ||
}, 200); | ||
|
||
</script> | ||
</body> | ||
</html> | ||
<!doctype html> | ||
<html> | ||
<!-- | ||
==References== | ||
Server-side: | ||
* http://docs.ros.org/indigo/api/roswww/html/ | ||
* http://wiki.ros.org/web_video_server | ||
* http://wiki.ros.org/rosbridge_suite/Tutorials/RunningRosbridge | ||
Client-side: | ||
* http://wiki.ros.org/roslibjs/Tutorials/BasicRosFunctionality | ||
* https://getbootstrap.com/docs/4.0/getting-started/introduction/ | ||
* https://getbootstrap.com/docs/4.0/layout/grid/ | ||
* https://github.com/jeromeetienne/virtualjoystick.js | ||
--> | ||
|
||
<head> | ||
<!-- Required meta tags --> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
|
||
<!-- Bootstrap CSS --> | ||
<link rel="stylesheet" href="css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="css/dashboard.css"> | ||
|
||
<title>Laboratoire S5-GRO525</title> | ||
|
||
</head> | ||
|
||
<body> | ||
|
||
<!-- Menu BEGIN--> | ||
<div class="collapse" id="navbarToggleExternalContent"> | ||
<div class="bg-dark p-4"> | ||
<h6 class="text-white h4">Configuration</h6> | ||
</div> | ||
</div> | ||
|
||
<nav class="navbar navbar-dark bg-dark"> | ||
<div> | ||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
</div> | ||
</nav> | ||
<!-- Menu END--> | ||
|
||
<!-- Main layout BEGIN--> | ||
<div class="container-fluid"> | ||
|
||
</div> | ||
|
||
<!-- JavaScript, import frameworks --> | ||
<!-- jQuery first, then Popper.js, then Bootstrap JS --> | ||
<script src="js/jquery-3.3.1.slim.min.js"></script> | ||
<script src="js/popper.min.js"></script> | ||
<script src="js/bootstrap.min.js"></script> | ||
<script src="js/virtualjoystick.js"></script> | ||
<script src="js/roslib.min.js"></script> <!-- rosbridge --> | ||
|
||
<!-- Custom scripts --> | ||
<script> | ||
// Define some global variables | ||
var rbServer = null; | ||
var cmdVelTopic = null; | ||
|
||
//Some initializations after the page has been shown | ||
$(document).ready(function(){ | ||
document.getElementById("log").value = 'Default text\n' | ||
}); | ||
|
||
// Define some functions | ||
function connectROS() { | ||
|
||
// This function connects to the rosbridge server running on the local computer on port 9090 | ||
rbServer = new ROSLIB.Ros({ | ||
url : 'ws://' + rosMasterIp + ':9090' | ||
}); | ||
|
||
rbServer.on('connection', function() { | ||
console.log('Connected to websocket server.'); | ||
|
||
// These lines create a topic object as defined by roslibjs | ||
cmdVelTopic = new ROSLIB.Topic({ | ||
ros : rbServer, | ||
name : '/prop_cmd', | ||
messageType : 'geometry_msgs/Twist' | ||
}); | ||
}); | ||
|
||
rbServer.on('error', function(error) { | ||
console.log('Error connecting to websocket server: ', error); | ||
}); | ||
|
||
rbServer.on('close', function() { | ||
console.log('Connection to websocket server closed.'); | ||
}); | ||
} | ||
|
||
|
||
// These lines create a message that conforms to the structure of the Twist defined in our ROS installation | ||
// It initalizes all properties to zero. They will be set to appropriate values before we publish this message. | ||
var twist = new ROSLIB.Message({ | ||
linear : { | ||
x : 0.0, | ||
y : 0.0, | ||
z : 2.0 // SET Control mode to 2 | ||
}, | ||
angular : { | ||
x : 0.0, | ||
y : 0.0, | ||
z : 0.0 | ||
} | ||
}); | ||
|
||
setInterval(function(){ | ||
if(cmdVelTopic != null) { | ||
// Publish the message | ||
cmdVelTopic.publish(twist); | ||
} | ||
}, 200); | ||
|
||
</script> | ||
</body> | ||
</html> |