Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/ros3d.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -53363,7 +53363,7 @@ eventemitter2.exports;
var obj = {};
var key;
var len = keys.length;
var valuesCount = values ? value.length : 0;
var valuesCount = values ? values.length : 0;
for (var i = 0; i < len; i++) {
key = keys[i];
obj[key] = i < valuesCount ? values[i] : undefined$1;
Expand Down
14 changes: 9 additions & 5 deletions build/ros3d.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -53339,7 +53339,7 @@ eventemitter2.exports;
var obj = {};
var key;
var len = keys.length;
var valuesCount = values ? value.length : 0;
var valuesCount = values ? values.length : 0;
for (var i = 0; i < len; i++) {
key = keys[i];
obj[key] = i < valuesCount ? values[i] : undefined$1;
Expand Down Expand Up @@ -55084,15 +55084,17 @@ InteractiveMarkerClient.prototype.subscribe = function subscribe (topic) {
ros : this.ros,
name : topic + '/tunneled/update',
messageType : 'visualization_msgs/InteractiveMarkerUpdate',
compression : 'png'
// compression : 'png'
compression : 'cbor'
});
this.updateTopic.subscribe(this.processUpdate.bind(this));

this.feedbackTopic = new ROSLIB.Topic({
ros : this.ros,
name : topic + '/feedback',
messageType : 'visualization_msgs/InteractiveMarkerFeedback',
compression : 'png'
// compression : 'png'
compression : 'cbor'
});
this.feedbackTopic.advertise();

Expand Down Expand Up @@ -55330,7 +55332,8 @@ var MarkerArrayClient = /*@__PURE__*/(function (EventEmitter2) {
ros : this.ros,
name : this.topicName,
messageType : 'visualization_msgs/MarkerArray',
compression : 'png'
// compression : 'png'
compression : 'cbor'
});
this.rosTopic.subscribe(this.processMessage.bind(this));
};
Expand Down Expand Up @@ -55449,7 +55452,8 @@ var MarkerClient = /*@__PURE__*/(function (EventEmitter2) {
ros : this.ros,
name : this.topicName,
messageType : 'visualization_msgs/Marker',
compression : 'png'
// compression : 'png'
compression : 'cbor'
});
this.rosTopic.subscribe(this.processMessage.bind(this));
};
Expand Down
29 changes: 19 additions & 10 deletions build/ros3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -53429,7 +53429,7 @@ var ROS3D = (function (exports, ROSLIB) {
var obj = {};
var key;
var len = keys.length;
var valuesCount = values ? value.length : 0;
var valuesCount = values ? values.length : 0;
for (var i = 0; i < len; i++) {
key = keys[i];
obj[key] = i < valuesCount ? values[i] : undefined$1;
Expand Down Expand Up @@ -55207,24 +55207,31 @@ var ROS3D = (function (exports, ROSLIB) {

this.updateTopic = new ROSLIB__namespace.Topic({
ros : this.ros,
name : topic + '/tunneled/update',
messageType : 'visualization_msgs/InteractiveMarkerUpdate',
compression : 'png'
// name : topic + '/tunneled/update',
// messageType : 'visualization_msgs/InteractiveMarkerUpdate',
name : topic + '/update',
messageType : 'visualization_msgs/msg/InteractiveMarkerUpdate',
// compression : 'png'
compression : 'cbor'
});
this.updateTopic.subscribe(this.processUpdate.bind(this));

this.feedbackTopic = new ROSLIB__namespace.Topic({
ros : this.ros,
name : topic + '/feedback',
messageType : 'visualization_msgs/InteractiveMarkerFeedback',
compression : 'png'
// messageType : 'visualization_msgs/InteractiveMarkerFeedback',
messageType : 'visualization_msgs/msg/InteractiveMarkerFeedback',
// compression : 'png'
compression : 'cbor'
});
this.feedbackTopic.advertise();

this.initService = new ROSLIB__namespace.Service({
ros : this.ros,
name : topic + '/tunneled/get_init',
serviceType : 'demo_interactive_markers/GetInit'
// name : topic + '/tunneled/get_init',
// serviceType : 'demo_interactive_markers/GetInit'
name : topic + '/simple_marker/get_interactive_markers',
serviceType : 'visualization_msgs/srv/GetInteractiveMarkers'
});
var request = new ROSLIB__namespace.ServiceRequest({});
this.initService.callService(request, this.processInit.bind(this));
Expand Down Expand Up @@ -55482,7 +55489,8 @@ var ROS3D = (function (exports, ROSLIB) {
ros : this.ros,
name : this.topicName,
messageType : 'visualization_msgs/MarkerArray',
compression : 'png'
// compression : 'png'
compression : 'cbor'
});
this.rosTopic.subscribe(this.processMessage.bind(this));
};
Expand Down Expand Up @@ -55619,7 +55627,8 @@ var ROS3D = (function (exports, ROSLIB) {
ros : this.ros,
name : this.topicName,
messageType : 'visualization_msgs/Marker',
compression : 'png'
// compression : 'png'
compression : 'cbor'
});
this.rosTopic.subscribe(this.processMessage.bind(this));
};
Expand Down
4 changes: 2 additions & 2 deletions build/ros3d.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion examples/continuousmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
function init() {
// Connect to ROS.
var ros = new ROSLIB.Ros({
url : 'ws://localhost:9090'
url : 'ws://localhost:9090',
groovyCompatibility: false
});

// Create the main viewer.
Expand Down
7 changes: 4 additions & 3 deletions examples/interactivemarkers.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
function init() {
// Connect to ROS.
var ros = new ROSLIB.Ros({
url : 'ws://localhost:9090'
url : 'ws://localhost:9090',
groovyCompatibility: false,
});

// Create the main viewer.
Expand All @@ -33,14 +34,14 @@
angularThres : 0.01,
transThres : 0.01,
rate : 10.0,
fixedFrame : '/rotating_frame'
fixedFrame : 'base_link'
});

// Setup the marker client.
var imClient = new ROS3D.InteractiveMarkerClient({
ros : ros,
tfClient : tfClient,
topic : '/basic_controls',
topic : '/simple_marker',
camera : viewer.camera,
rootObject : viewer.selectableObjects
});
Expand Down
96 changes: 96 additions & 0 deletions examples/intermarker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env python3

# Copyright (c) 2011, Willow Garage, Inc.
# All rights reserved.
#
# Software License Agreement (BSD License 2.0)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Willow Garage, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

import sys

from interactive_markers import InteractiveMarkerServer
import rclpy
from visualization_msgs.msg import InteractiveMarker
from visualization_msgs.msg import InteractiveMarkerControl
from visualization_msgs.msg import Marker


def processFeedback(feedback):
p = feedback.pose.position
print(f'{feedback.marker_name} is now at {p.x}, {p.y}, {p.z}')


if __name__ == '__main__':
rclpy.init(args=sys.argv)
node = rclpy.create_node('simple_marker')

# create an interactive marker server on the namespace simple_marker
server = InteractiveMarkerServer(node, 'simple_marker')

# create an interactive marker for our server
int_marker = InteractiveMarker()
int_marker.header.frame_id = 'base_link'
int_marker.name = 'my_marker'
int_marker.description = 'Simple 1-DOF Control'

# create a grey box marker
box_marker = Marker()
box_marker.type = Marker.CUBE
box_marker.scale.x = 0.45
box_marker.scale.y = 0.45
box_marker.scale.z = 0.45
box_marker.color.r = 0.0
box_marker.color.g = 0.5
box_marker.color.b = 0.5
box_marker.color.a = 1.0

# create a non-interactive control which contains the box
box_control = InteractiveMarkerControl()
box_control.always_visible = True
box_control.markers.append(box_marker)

# add the control to the interactive marker
int_marker.controls.append(box_control)

# create a control which will move the box
# this control does not contain any markers,
# which will cause RViz to insert two arrows
rotate_control = InteractiveMarkerControl()
rotate_control.name = 'move_x'
rotate_control.interaction_mode = InteractiveMarkerControl.MOVE_AXIS

# add the control to the interactive marker
int_marker.controls.append(rotate_control)

# add the interactive marker to our collection &
# tell the server to call processFeedback() when feedback arrives for it
server.insert(int_marker, feedback_callback=processFeedback)

# 'commit' changes and send to all clients
server.applyChanges()

rclpy.spin(node)
server.shutdown()
33 changes: 33 additions & 0 deletions examples/mappa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import rclpy
from rclpy.node import Node
from nav_msgs.msg import OccupancyGrid

class MapPublisher(Node):
def __init__(self):
super().__init__('map_publisher')
self.publisher_ = self.create_publisher(OccupancyGrid, '/map', 10)
self.timer_ = self.create_timer(1.0, self.publish_map) # Publicar cada 1 segundo
self.map_ = OccupancyGrid()
self.map_.header.frame_id = 'map'
self.map_.info.width = 100 # Ancho del mapa
self.map_.info.height = 100 # Alto del mapa
self.map_.info.resolution = 0.1 # Resolución del mapa (metros/píxel)
self.map_.data = [0] * (self.map_.info.width * self.map_.info.height) # Datos de ocupación del mapa

def publish_map(self):
# Generar datos realistas del mapa (aquí puedes inventar tus propios datos)
for i in range(len(self.map_.data)):
self.map_.data[i] = 100 # Valor de ocupación máximo (totalmente ocupado)

self.publisher_.publish(self.map_)

def main(args=None):
rclpy.init(args=args)
publisher = MapPublisher()
rclpy.spin(publisher)
publisher.destroy_node()
rclpy.shutdown()

if __name__ == '__main__':
main()

5 changes: 3 additions & 2 deletions examples/markers.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
function init() {
// Connect to ROS.
var ros = new ROSLIB.Ros({
url : 'ws://localhost:9090'
url : 'ws://localhost:9090',
groovyCompatibility: false,
});

// Create the main viewer.
Expand All @@ -32,7 +33,7 @@
angularThres : 0.01,
transThres : 0.01,
rate : 10.0,
fixedFrame : '/my_frame'
fixedFrame : 'my_frame'
});

// Setup the marker client.
Expand Down
Loading