I'm able to establish a firm connection over rosbridge_server with roslibjs, however, whenever I call .publish() the Websocket disconnects and returns
I've tried calling JSON.stringify() to shorten the message size.
I've ensure the message is of the right format.
<script type="text/javascript" src="http://static.robotwebtools.org/EventEmitter2/current/eventemitter2.min.js"></script>
<script type="text/javascript" src="http://static.robotwebtools.org/roslibjs/current/roslib.min.js"></script>
var ros = new ROSLIB.Ros({
url : 'ws://192.168.1.122:9090'
});
var rosbridge_obj = new ROSLIB.Topic({
ros : ros,
name : '/topicname',
messageType : 'topicname/messagetype'
});
var message_obj = new ROSLIB.Message({
header : {
seq : 0,
stamp : 8768,
frame_id : 'Redacted',
},
mobility : {
ForwardY : 0,
TurningX : 0,
},
arm : {
J1 : 0,
J2 : 0,
J3 : 0,
J4 : 0,
J51 : 0,
J52 : 0,
},
mode : {
mode : 0,
},
});
rosbridge_obj.publish(message_obj);
Expected result is that the Websocket will publish and not close however I receive the following:
CloseEvent
bubbles: false
code: 1009
composed: false
currentTarget: WebSocket {url: "ws://192.168.1.122:9090/", readyState: 3, bufferedAmount: 0, onopen: ƒ, onerror: ƒ, …}
defaultPrevented: false
eventPhase: 0
isTrusted: true
path: []
reason: "message too big"
returnValue: true
I encountered the same problem using roslibpy, I was running basic examples of publisher and the connection was closed immediately after publishing the message with error:
WebSocket connection closed: Code=1009, Reason=message too big
It turns out, rosbridge_websocket.launch has a parameter max_message_size which is by default set to None. When I changed it to Inf it started working.
If you have your own launch file:
<include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch">
<arg name="max_message_size" value="Inf" />
</include>
or just (from the command line):
roslaunch rosbridge_server rosbridge_websocket.launch max_message_size:=Inf
Hope this will help, it helped me.
This turned out to be a hardware specific issue. The issue was completely resolved after switching to new hardware.
Related
I want to make a Bot, that plays a livestream of an online radio. I use Discord JS v13.
On Heroku I have installed the following buildpacks:
heroku/nodejs
https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git
https://github.com/xrisk/heroku-opus.git
https://github.com/OnlyNoob/heroku-buildpack-libsodium.git
My code is the following:
let voiceChn = message.member.voice.channel;
const connection = joinVoiceChannel({
channelId: message.member.voice.channel.id,
guildId: message.member.voice.channel.guildId,
adapterCreator: message.guild.voiceAdapterCreator,
selfDeaf: true
});
const player = createAudioPlayer();
let resource = createAudioResource(STREAM_URL);
connection.subscribe(player);
connection.on(VoiceConnectionStatus.Ready, () => {
player.play(resource);
});
It does work running on my pc but it does not run on Heroku.
These are the packages I have installed:
"#discordjs/opus": "^0.5.3"
"#discordjs/rest": "^0.5.0"
"#discordjs/voice": "^0.10.0"
"discord-api-types": "^0.36.0"
"discord.js": "^13.8.1"
"ffmpeg-static": "^4.4.1"
"libsodium-wrappers": "^0.7.10"
I do get the following error: The player immediately emits the idle event and thats logged:
{
status: 'playing',
missedFrames: 0,
playbackDuration: 120,
resource: AudioResource {
playStream: OggDemuxer {
_readableState: [ReadableState],
_events: [Object: null prototype],
_eventsCount: 5,
_maxListeners: undefined,
_writableState: [WritableState],
allowHalfOpen: true,
_remainder: null,
_head: null,
_bitstream: null,
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
edges: [ [Object], [Object] ],
metadata: null,
volume: undefined,
encoder: undefined,
audioPlayer: undefined,
playbackDuration: 0,
started: true,
silencePaddingFrames: 5,
silenceRemaining: 0
},
onStreamError: [Function: onStreamError]
}
Not sure about the error, but I believe I had the same problem and fixed it.
Didn't test if all the changes are needed, but here goes:
Instead of your heroku-buildpack-libsodium package, I use:
https://github.com/Crazycatz00/heroku-buildpack-libopus
Changed every URLs 'https' with 'http'
Use a DNS lookup tool to change domain name with IPV4 form
'https://stream.skymedia.ee/live/NRJdnb' becomes 'http://185.31.240.229:8888/NRJdnb'
Deploy slash commands after you change their code
I'm trying to learn web assembly. I'm able to compile wasm from C code. However I'm having a lot of difficulty trying to get my code to run in Firefox. My code is very basic:
hello.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
</body>
<script async type="text/javascript" src="hello.js"></script>
</html>
hello.js
"use strict";
const imports = {
env: {
"abort": function() {},
"memoryBase": 0,
"tableBase": 0,
"memory": new WebAssembly.Memory({ initial: 4 }),
"table": new WebAssembly.Table({ initial: 0, element: 'anyfunc' }),
}
}
WebAssembly.instantiateStreaming(fetch('hello.wasm'), imports)
.then(obj => console.log(obj.instance.exports._add(1, 2)))
.catch(error => console.log(error));
hello.c
#include <emscripten.h>
EMSCRIPTEN_KEEPALIVE int add(x, y) { return x + y; }
I compile my code like this:
emcc hello.c -O1 -g4 -s WASM=1 -s SIDE_MODULE=1 -o hello.wasm --source-map-base http://localhost:8080/ --emrun
and I use emrun to serve my files
emrun --no_browser --port 8080 .
The Problem
Initially, Firefox was complaining with LinkError: "import object field 'abort' is not a Function". Inspecting hello.wast, generated during compilation, it looks like an abort function is indeed required (I'm guessing abort() is an expected part of the C runtime). So, I added the "abort": function() {}, line to the env section of imports.
But now I get a LinkError: "imported Table with incompatible size". I'm at a loss at to what this error is trying to indicate. How can I get my wasm code to run?
I'm trying to debug with Firefox Developer Edition 63.0b8 (64-bit).
emcc is 1.38.11.
I am an idiot. Change the 0 here to any other number. For example:
"table": new WebAssembly.Table({ initial: 0, element: 'anyfunc' }),
|
v
"table": new WebAssembly.Table({ initial: 2, element: 'anyfunc' }),
This hello.js file should work.
"use strict";
const imports = {
env: {
"abort": function() {},
"memoryBase": 0,
"tableBase": 0,
"memory": new WebAssembly.Memory({ initial: 4 }),
"table": new WebAssembly.Table({ initial: 4, element: 'anyfunc' }),
}
}
WebAssembly.instantiateStreaming(fetch('hello.wasm'), imports)
.then(obj => console.log(obj.instance.exports._add(1, 2)))
.catch(error => console.log(error));
I have a electron app, so in my dashboard page i am getting an error look like this
Error: Unhandled "error" event.(File not found)
I am using tradingview widget.
var widget = new TradingView.widget({
// debug: true, // uncomment this line to see Library errors and warnings in the console
fullscreen: true,
symbol: 'AA',
interval: 'D',
container_id: "tv_chart_container",
// BEWARE: no trailing slash is expected in feed URL
datafeed: new Datafeeds.UDFCompatibleDatafeed("http://abc.loc/api"),
library_path: "../../assets/charting_library/",
locale: "en",
// Regression Trend-related functionality is not implemented yet, so it's hidden for a while
drawings_access: { type: 'black', tools: [ { name: "Regression Trend" } ] },
disabled_features: ["use_localstorage_for_settings"],
enabled_features: ["study_templates"],
charts_storage_url: 'http://saveload.tradingview.com',
charts_storage_api_version: "1.1",
client_id: 'tradingview.com',
user_id: 'public_user_id'
});
How can I get the file name which can not be found. Thanks!
I'm trying to write a test for Gridmapper. This is a an application that uses ordinary ASCII keys to control the application. I'm trying to write a test to determine whether 'w' does what it is intended to do. Sadly, I can't write a test that works for both ChromeDriver and FirefoxDriver.
This is how I accept key events in my app:
document.onkeydown = keyPressed; // capture arrow keys
document.onkeypress = keyPressed; // capture character keys
This is a test that works for Chrome:
module.exports = {
'walls' : function (browser) {
browser
.url('file://' + process.cwd() + '/gridmapper.svg')
.assert.elementPresent('#walls0')
.keys('w')
.waitForElementPresent('#wall_0_0', 1000)
.end();
}
};
This is the same test such that it works for Firefox:
module.exports = {
'walls' : function (browser) {
browser
.url('file://' + process.cwd() + '/gridmapper.svg')
.assert.elementPresent('#walls0')
.sendKeys('#ui', 'w')
.waitForElementPresent('#wall_0_0', 1000)
.end();
}
};
What am I doing wrong? I tried all sorts of combinations, tried sending the event to the document root element and a few more options, but I'm running out of ideas.
You'll want to get the browserName and that's stored in the capabilities object. You may or may not need to do further operations on the string, but toUpperCase should work.
You can add conditionals, you will just need to use the 'browser.' notation for each subsequent command.
Something like this should do the trick.
module.exports = {
'walls' : function (browser) {
var runtimeBrowser = browser.capabilities.browserName.toUpperCase()
browser
.url('file://' + process.cwd() + '/gridmapper.svg')
.assert.elementPresent('#walls0')
if(runtimeBrowser === "CHROME"){
browser.keys('w')
} elseif(runtimeBrowser === "FIREFOX") {
browser.sendKeys('#ui', 'w')
} else {
// do other default thing
}
browser.waitForElementPresent('#wall_0_0', 1000)
browser.end();
}
};
I didn't find a way to do it so now I'm generating test files for Firefox from the test files for Chrome.
nightwatch.json uses two test directories:
{
"src_folders" : ["tests/chrome", "tests/firefox"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"globals_path" : "",
"selenium" : {
"start_process" : true,
"server_path" : "./bin/selenium-server-standalone-3.0.1.jar",
"log_path" : "",
"port" : 4444,
"cli_args" : {
"webdriver.chrome.driver" : "./bin/chromedriver",
"webdriver.gecko.driver" : "./bin/geckodriver"
}
},
"test_settings" : {
"default" : {
"launch_url" : "http://localhost",
"selenium_port" : 4444,
"selenium_host" : "localhost"
},
"chrome" : {
"desiredCapabilities": {
"browserName": "chrome"
},
"filter" : "tests/chrome/*.js"
},
"firefox" : {
"desiredCapabilities": {
"browserName": "firefox",
"marionette": true
},
"filter" : "tests/firefox/*.js"
}
}
}
Makefile allows me to run Chrome tests or Firefox tests. Firefox tests are generated from Chrome tests using a search and replace with sed:
chrome-test-files := $(wildcard tests/chrome/*.js)
firefox-test-files := $(patsubst tests/chrome/%,tests/firefox/%,$(chrome-test-files))
all:
#echo "Did you want to run 'make tests'?"
test: test-firefox test-chrome
test-firefox: $(firefox-test-files)
node_modules/.bin/nightwatch --env firefox
test-chrome: $(chrome-test-files)
node_modules/.bin/nightwatch --env chrome
tests/firefox/%.js: tests/chrome/%.js
#mkdir -p tests/firefox
sed -e "s/\.keys(/.sendKeys('#ui',/" < $< > $#
And now it all works and I'm still disappointed that there was no easy answer within Nightshift.
To compress Javascript and CSS files I am using Yahoo for a solution. Net (http://yuicompressor.codeplex.com/)
I have an object:
defaults = {
html: "",
opacity: 0.6,
loadOnDemand: true,
showEffect: "fade",
hideEffect: "fade"
};
Note the value 0.6
Result after compression:
defaults = {
html : "",
opacity : 0,
6,
loadOnDemand : true,
showEffect : "fade",
hideEffect : "fade"
};
I am using the task (MSBuild) for Visual Studio to compress my JS.
The following XML code:
<CompressorTask
CssFiles="#(CssFiles)"
CssOutputFile="$(cssFile)"
CssCompressionType="YuiStockCompression"
PreserveCssComments="false"
JavaScriptFiles="#(JavaScriptFiles)"
ObfuscateJavaScript="false"
PreserveAllSemicolons="true"
DisableOptimizations="Nope"
JavaScriptOutputFile="$(jsFile)"
LoggingType="ALittleBit"
IsEvalIgnored="false" />
Full code in: https://gist.github.com/1817326
looking for an answer, found this thread: http://yuicompressor.codeplex.com/discussions/243522
But did not help me much