Unreadable output results when typing "make login" - contiki

I want to test the hello world application in a z1 mote. Unfortunately, when I try to visualize the results in the terminal using this command: make z1-reset & make login,
I always get an unreadable result:
������������������������󠰮����à������������������������������頲��
I run the test in Ubuntu 12.04 using contiki 2.7 and msp430-gcc 4.6.3
Are there any necessary drivers for zolertia z1 motes that I forgot to install?
Thanks in advance.
Best regards.

I faced the same problem a few weeks ago working on the Z1 ...what u should do is update the GCC-version to 4.7.0
You can follow these steps to upgrade the MSP430-gcc:
Update msp430 to version 4.7.0 follow http://wiki.contiki-os.org/doku.php?id=msp430x
After finish install msp430 version 4.7.0, move folder mspgccx from /opt/tmp/ to /opt/
Run export PATH=/opt/mspgccx/bin:$PATH on terminal for temporary, but for permanent need to put in bash_rc or bash_profile.
Then can compile contiki code.
Someone shared it with me and it did work for me..hope it works for you =) Read the steps carefully, it is a little tricky. Good luck.

It is possible the Z1 is already sending data over the USB port before the make login is finished and ready to receive, resulting in weird data. Try resetting the Z1 mote using a reset button or a on/off switch.
If that resets the login program, then you could try a LED example.
Or try below example that repeats the hello world message:
#include "contiki.h"
#include <stdio.h> /* For printf() */
PROCESS(hello_world_process, "Hello world process");
AUTOSTART_PROCESSES(&hello_world_process);
PROCESS_THREAD(hello_world_process, ev, data)
{
static struct etimer et;
PROCESS_BEGIN();
printf("First Hello world\n");
while(1){
//wait 1 second
etimer_set(&et, CLOCK_SECOND);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
printf("Hello world\n\n");
}
PROCESS_END();
}

Related

Nao robot IMU data rates

I'm trying to stream data from the Nao's inertial unit in its trunk. However the update rate is quite slow ~ 1Hz. Is there any way to improve it? For reference, I issued the following command using qicli to measure the rates:
qicli call --json ALMemory.getListData "[[\"Device/SubDeviceList/InertialSensor/AngleY/Sensor/Value\"]]"
In this example I retrieve the tilt angle of the trunk around the Y-axis (pitch).
To execute this command, I established an SSH connection to the Nao. I timed it using the linux time command. I also tried to force a faster read rate by issuing the above command in a loop with 5 milliseconds of sleep between each iteration:
for i in {1..100}; do qicli call --json ALMemory.getListData "[[\"Device/SubDeviceList/InertialSensor/AngleY/Sensor/Value\"]]"; sleep 0.005; done
But even in this case I could see that the data was read at about a rate of 1Hz.
I tried it on Nao versions 5 and 6. I also connected both over WiFi and a link-locally using an ethernet cable.
This data is available every 10ms, but a qicli call takes a long time to init the connection.
Try using the api in python, create a proxy then call the getData in the loop, refer to the API documentation here.
As a side note, best way to record data or to monitor it efficiently is to process it directly on the NAO. Connect using ssh upload your program and run it, or use choregraphe to create and run it directly on the robot easily.
# edit: adding simple script to be run directly on NAO (untested)
import time
import naoqi
mem = naoqi.ALProxy("ALMemory","localhost",9559)
while 1:
val = mem.getData("Device/SubDeviceList/InertialSensor/AngleY/Sensor/Value")
print(val)
time.sleep(0.01)

How do I connect xterm.js(in electron) to a real working command prompt?

I've dug myself into a deep rabbit hole trying to find out what the title says. If you're confused about what this question is, I'll give a more detailed explanation: Have you ever seen the VSCode Terminal? or Terminus? Well I want to do what those applications do. I have an electron app, and for the users convenience I want to include a command prompt of some sorts into it. I've looked in to xterm.js, but I can only find examples of things like SSH, not a direct link to a console hosted on the system. What I'm asking is how do I connect xterm.js(in electron) to a real working command prompt? I've seen programs able to interact with cmd.exe such as Windows Terminal. I'll use it as an example.
Image taken from process hacker
In the attached photo you can see three processes. WindowsTerminal.exe, OpenConsole.exe, and cmd.exe. After digging around in the source code of Windows Terminal, I can see the OpenConsole.exe gets started with every instance of a cmd that you make. So I assume that is the program that's interacting with cmd.exe. Now I know that Windows Terminal is made using UWP but you can see similar things happening with VSCode(I opened a bunch of terminals to demonstrate)
here is another post with a similar question, but with no answers. I hope this one gains some traction.
So if you can answer, thanks. If you got sidetracked a bit, remember my question: How do I connect xterm.js(in electron) to a real working command prompt?
Sorry if you couldn't understand my wording, im not very good at this :P
The following video was helpful for me. Shortly, you need to :
install node-pty and electron-rebuild packages (additional to the xterm)
Place the following codes to appropriate process files
In the main process (main.js):
const os = require('os');
const pty = require('node-pty');
var shell = os.platform() === "win32" ? "powershell.exe" : "bash";
var ptyProcess = pty.spawn(shell, [], {
name: 'xterm-color',
cols: 80,
rows: 24,
cwd: process.env.HOME,
env: process.env
});
ptyProcess.on("data", (data) => {
mainWindow.webContents.send("terminal-incData", data);
});
ipcMain.on("terminal-into", (event, data)=> {
ptyProcess.write(data);
})
In the renderer process:
const Terminal = require('xterm').Terminal;
const FitAddon = require('xterm-addon-fit').FitAddon;
const term = new Terminal();
const fitAddon = new FitAddon();
term.loadAddon(fitAddon);
// Open the terminal in #terminal-container
term.open(document.getElementById('terminal-container'));
term.onData(e => {
ipcRenderer.send("terminal-into", e);
} );
ipcRenderer.on('terminal-incData', (event, data) => {
term.write(data);
})
// Make the terminal's size and geometry fit the size of #terminal-container
fitAddon.fit();
run electron-rebuild command if you get an error.
You might get the following errors when you try to install electron-rebuild package:
Solution for MAC: error: no template named 'remove_cv_t'.
Solution for Windows: gyp ERR! find Python
I figured it out, code on github: https://github.com/77Z/electron-local-terminal-prototype

Can't locate Arduino AT-Tiny

I have 2 types of ARDUINO-cards. ATMEGA 2560 and ATMEGA 328P.
In my Delphi7 (XP64 sp2) I have modified the JvHidDeviceController Unit to show the PID/VID's of the abovementioned Cards. That works perfectly. And with the use of the TComPort unit I can communicate with the selected card. No problems here.
And here is the problem:
I connect my AVR MARK II (usb-tiny). System "says" OK.
(When I run the ARUINO program I have no problems communicating with the connected card.)
I run the Delphi program (JVHidDeviceController Unit), the 2560 and 328p PID/VID appear in a LIST-box but NOT the AVR-MARK II.
I Wonder why ? Please help.
After a search on the WWW I discovered, that the UNO (328P) could be turned into a ISP programmer. And by doing so I solve 2 (sub-)problems. I got the code ("bootloader") and the UNO Stills responds to the JVHidDeviceController requests. (Final solution in reach.. ) Kris

Lua ESP8266 script expecting extra =

I am trying to test a proximity sensor with my ESP8266, however the test code I am using keeps failing.
Whenever I run the code, I get an error: motion sensor.lua:1: '=' expected near 'int'
I should also mention I am using ESPlorer v0.2.0
const int PIRSensorOutPin = 2; //PIR Sensor OUT Pin
void setup() {
Serial.begin(9600);
pinMode(PIRSensorOutPin, INPUT);
}
void loop()
{
if (digitalRead(PIRSensorOutPin) == LOW)
{
Serial.println("Person detected!"); //Print to serial monitor
}
else {;}
}
What am I doing wrong?
The Lua interpreter doesn't understand C++.
You're running NodeMCU firmware which runs Lua files. But you're trying to run Arduino C++ code. That's not going to work. To run this code you would have to add ESP8266 support to your Arduino IDE, compile your code and flash it onto the ESP.
Alternatively write your code in Lua.
https://github.com/esp8266/Arduino
https://www.nodemcu.com/index_en.html
What am I doing wrong?
Using the wrong programming language.
NodeMCU wants to run Lua code and you're giving it C code instead, which just can't work.
How do I fix it? (implied)
You can use the arduino IDE to write C++ code for ESP8266, but since you already seem to have everything set up to run Lua code, I suggest just using that instead.
The C code you provided could be rewritten into Lua using the NodeMCU api like this:
local pin = 2 -- The number of the I/O Pin
local type = "down" -- Trigger on falling edge
-- https://nodemcu.readthedocs.io/en/master/modules/gpio/#gpiotrig
gpio.trig(pin, type, function()
print("Movement detected, proceding to exterminate!")
end)

mp3 # 0x1768ac0 Header missing

I have a school project using Opencv, a Raspberry pi 2, a Raspicam and C++. Our project needs to use a video stream from the camera to detect objects.
That's why I assume to use pipe and fifo by this line :
mkfifo fifo;
raspivid -t 0 -o fifo & ./Detection fifo
As a result I get :
[mp3 # 0x1768ac0] Header missing
But when a well saved video is sent to the program, our project perfectly runs.
Example of good behavioured instructions :
raspivid -t 10000 -o video.h264 ; ./Detection video.h264
Do someone have an idea ?
All result I found where not suitable for our project. I maybe miss some important information.
Thank you
PS : Hope I am understandable, my english is not that good

Resources