Pepper Robot Wheel Control - nao-robot

Is there a way to control the individual wheels of the Pepper in a fashion similar to how you can control the legs of the NAO?
We would like to use our own motion controller for the base of the robot, but it seems that any commands send to the wheel via DCM are automatically overwritten by ALMotion.

It turns out that setting stiffness via DCM is not possible if you provide the value in the form of an integer. For example:
service.setAlias(['WheelStiffness', 'Merge', 'time-mixed', [
[[ 1, service.getTime(0) ]],
[[ 1, service.getTime(0) ]],
[[ 1, service.getTime(0) ]],
]])
Does not work, where-as the following does:
service.setAlias(['WheelStiffness', 'Merge', 'time-mixed', [
[[ 1.0, service.getTime(0) ]],
[[ 1.0, service.getTime(0) ]],
[[ 1.0, service.getTime(0) ]],
]])

Related

Legend and Color For HeatMapLayer using Point Count - Azure Maps

I would like to add a legend to my Heat Map Layer using LegendControl Module. I want to add StopColors in the legend using the number of points. However the HeatMapLayer color option only allows HeatMapDensity (0 to 1) in the data expression. How do we assign colors to HeatMapLayer using "interpolate" expression and the number of points ?
color: [
'interpolate',
['linear'],
['heatmap-density'],
0,
'rgba(0,0,0,0)',
0.2,
'royalblue',
0.4,
'cyan',
0.6,
'lime',
0.8,
'yellow',
1,
'red'
],
However adding ['get','point_count'] to the color throws error inplace of heatmap_density. How to create a legend and color the heat map based on number of points ? Thanks !
Sounds like you are trying to create a weighted heat map. Use the weight option. For example:
var layer = new atlas.layer.HeatMapLayer(datasource, null, {
weight: ['get', 'point_count']
});

jq: delete element from array

I have this JSON file and want to delete an element from an array:
{
"address": "localhost",
"name": "local",
"vars": {
"instances": [
"one",
"two"
]
}
}
I am using this command:
jq 'del(.vars.instances[] | select(index("one")))' data.json
The output is:
{
"address": "localhost",
"name": "local",
"vars": {
"instances": [
"two"
]
}
}
So it works as expected, but only with jq v1.6. With jq v1.5 I get this error:
jq: error (at data.json:20): Invalid path expression near attempt to access element 0 of [0]
So what am I doing wrong? Is this a bug or a feature of v1.5? Is there any workaround to get the same result in v1.5?
Thanks in advance
Vince
One portable to work with on both versions would be,
.vars.instances |= map(select(index("one")|not))
or if you want to still use del(), feed the index of the string "one" to the function as below, where index("one") gets the index 0 which then gets passed to delete as del(.[0]) meaning to delete the element at zeroth index.
.vars.instances |= del(.[index("one")])
The implementation of del/1 has proven to be quite difficult and indeed it changed between jq 1.5 and jq 1.6, so if portability across different versions of jq is important, then usage of del/1 should either be restricted to the least complicated cases (e.g., no pipelines) or undertaken with great care.

How can I build this kind of UI, from AWS Comprehend Medical?

I'm using the AWS machine learning service Comprehend Medical to analyse clinical texts and extract data.
Some context info (skippable maybe):
This is the type of input:
Pt is 40yo mother, highschool teacher
HPI : Sleeping trouble on present dosage of Clonidine. Severe Rash on face and leg, slightly itchy
Meds : Vyvanse 50 mgs po at breakfast daily,
Clonidine 0.2 mgs -- 1 and 1 / 2 tabs po qhs
HEENT : Boggy inferior turbinates, No oropharyngeal lesion
Lungs : clear
Heart : Regular rhythm
Skin : Mild erythematous eruption to hairline
Follow-up as scheduled
This is the kind of output I get from AWS:
{
"Entities": [
{
"Id": 0,
"BeginOffset": 6,
"EndOffset": 10,
"Score": 0.9984116554260254,
"Text": "40yo",
"Category": "PROTECTED_HEALTH_INFORMATION",
"Type": "AGE",
"Traits": []
},
{
"Id": 1,
"BeginOffset": 19,
"EndOffset": 37,
"Score": 0.28823626041412354,
"Text": "highschool teacher",
"Category": "PROTECTED_HEALTH_INFORMATION",
"Type": "PROFESSION",
"Traits": []
},
...
Then I would like to render this kind of UI, the same way AWS does in their console to represent Comprehend medical outputs (see the image) :
AWS Console Comprehend Medical output representation
I managed to tag the text. But I have no idea in how to make the tagged arrows: represent those dependecies between html elements.
I have tried some react libraries like Taggy(only do tagging) and explored some other solutions like Spacey (will require SSR and not even the same output of tags + tagged arrows ),
Anyone could suggest an approach to do this kind of tagged arrows between those html components?
Thank you ma people.

Sorting a 2D array with one row

I've recently started scripting in PowerShell and I'm having a difficulty in sorting a 2D array by multiple columns.
The following code is working fine. I have a 2D array (5x4) and I sort it by two columns; first, by the second column, and then by the first column.
$table1 = ("hhctrl.ocx",21,503,"Microsoft® HTML Help Control"),("mscomct2.ocx",10,629,"Microsoft Common Controls 2 ActiveX Control DLL"),("msscript.ocx",2,86,"Microsoft ® Script Control"),("sysmon.ocx",15,384,"System Monitor Control"),("tdc.ocx",1,61,"TDC ActiveX Control")
$table1_sorted = $table1 | Sort-Object #{Expression={$_[1]}; Ascending=$false}, #{Expression={$_[0]}; Ascending=$true}
echo (var_dump $table1)
echo (var_dump $table1_sorted)
var_dump is a custom function. I've created it to debug arrays. Write-Host and echo, they both flatten the arrays and don't seperate the items (no comma between items) e.g.
hhctrl.ocx 21 503 Microsoft® HTML Help Control mscomct2.ocx 10 629 Microsoft Common Controls 2 ActiveX Control DLL msscript.ocx 2 86 Microsoft ® Script Control sysmon.ocx 15 384 System Monitor Control tdc.ocx 1 61 TDC ActiveX Control
var_dump outputs:
[
[
"hhctrl.ocx",
21,
503,
"Microsoft® HTML Help Control"
],
[
"mscomct2.ocx",
10,
629,
"Microsoft Common Controls 2 ActiveX Control DLL"
],
[
"msscript.ocx",
2,
86,
"Microsoft ® Script Control"
],
[
"sysmon.ocx",
15,
384,
"System Monitor Control"
],
[
"tdc.ocx",
1,
61,
"TDC ActiveX Control"
]
]
[
[
"hhctrl.ocx",
21,
503,
"Microsoft® HTML Help Control"
],
[
"sysmon.ocx",
15,
384,
"System Monitor Control"
],
[
"mscomct2.ocx",
10,
629,
"Microsoft Common Controls 2 ActiveX Control DLL"
],
[
"msscript.ocx",
2,
86,
"Microsoft ® Script Control"
],
[
"tdc.ocx",
1,
61,
"TDC ActiveX Control"
]
]
Now, if I use another array, "table" with only one row, sorting flattens the array.
$table2 = ,("hhctrl.ocx",21,503,"Microsoft® HTML Help Control")
$table2_sorted = $table2 | Sort-Object #{Expression={$_[1]}; Ascending=$false}, #{Expression={$_[0]}; Ascending=$true}
echo (var_dump $table2)
echo (var_dump $table2_sorted)
Output:
[
[
"hhctrl.ocx",
21,
503,
"Microsoft® HTML Help Control"
]
]
[
"hhctrl.ocx",
21,
503,
"Microsoft® HTML Help Control"
]
This happens when there's only one row. Why is that?
Sort-Object does not return array. It return write to pipeline individual input items in sorted order.
PS> 7,3,8,5,1 | Sort-Object | ForEach-Object { Write-Host "Item: $_" }
Item: 1
Item: 3
Item: 5
Item: 7
Item: 8
As you can see, next command in pipeline ForEach-Object see each individual item, but not array as whole.
Wrapping to array in $table1 case happens, because last command in pipeline wrote more than one item in pipeline. In $table2 case last command in pipeline wrote only one item, so no wrapping necessary there. If you want to always wrap pipeline results into array regardless of amount of results (zero, one or many), then you need to use array subexpression operator:
$Results = #( First-Command | Middle-Command | Last-Command )

How to pull even numbers for an Array in MongoDB?

Let's say we have the following document:
db.test.insert({a: [2, 3, 4, 5, 6, 7, 8]})
How to remove all even numbers and just left [3, 5, 7]? Can this be accomplished by using the $pull operator?
You can pull all even elements from your array using the $pull update operator and the $mod query operator. To update multiple documents I suggest you use the updateMany method and for single update you should use the updateOne method because update is highlighted as deprecated in official language driver. The problem is that shell method lagged behind the drivers. Also nobody really writes application in the shell.
db.test.updateMany({}, { "$pull": { "a": { "$mod": [ 2, 0 ] } } } )

Resources