Thursday, March 30, 2017


A nice interactive map displaying data from HOLC "security maps" of the 1930s.

It should not be surprising, but it is illuminating to read such blatant discrimination on seemingly mundane government reports.

"DETRIMENTAL INFLUENCES: Infiltration of colored residents. There are now about twelve families scattered over the area indicated"

"Infiltration of undesirables/dark Portuguese/Oriental store-keepers/Orientals: serious threat/subversive races exist"

Monday, February 6, 2017

VR sword haptics

The latest virtual reality craze is great because it looks like we are finally getting some nice, relatively affordable visual displays along with integrated controller systems. I played ping pong on one and was impressed. I think that playing VR ping pong would improve someone’s ability to play ping pong IRL. That’s a test of usefulness.

But the big problem with VR is haptics. A VR system can only achieve so much by simulating vision and sound (and sometimes proprioception). To really step up the level of immersion and to open up new interaction possibilities, incorporating the sense of touch is required.

Laura, John, and I were discussing this and thought that sword haptics could be very compelling. Sword haptics have a surprisingly simple set of basic requirements: to create torques in two axes. Any hit on a sword, above the handle, could be simulated by a torque in the handle. The exception is a direct thrust down the axis of the sword, which could easily be fudged into a torque in gameplay.

It is somewhat counterintuitive to accept that only torque is required because when we imagine the case of two swords slamming together and locking (think of the two fighters staring at each other across the swords and trembling with exertion), we think of them pushing forward with their swords, not swinging. But because the point of contact is removed from the center of pressure of the wrist(s), the handle sees only a torque. The fighter’s body can only apply as much force forward as the wrists can maintain in torque with a lever arm to the point of contact. As a rough spec for testing feasibility, two human wrists on a handle can apply a torque of about 30N*m statically.

One way of implementing haptics like this is to use cables anchored to various points in a room to apply forces to the tip of a mock sword. We tested this out by building a prototype system that allowed us to move around the cable winch anchor positions in order to find a workable configuration. In order to keep up with someone swinging a ~1m long sword around, the cable reel-in/reel-out linear speed must be high (about 7m/s), but not unreasonably so. The winch system to drive the cable could cost <$100.

The problem with this approach is the tradeoff between usable space (the volume where forces on the sword tip can be controlled in all directions), and the cables interfering with the movement of the sword wielder. The usable space is defined by a convex hull with vertices at each of the anchor points, and with shallow concavities in each of the faces (because the cables must apply an exponentially increasing tension in order to achieve an outward force as the tip approaches the surfaces of the hull). There is a decent workable solution without interference if the wielder stands at or just inside the boundary of the hull, facing into it with the sword. But this limits the wielder’s flexibility to turn around or to swing the sword too far in either direction around her. On the other hand, if the player stands inside the hull, in order to have greater usable space and flexibility, the cables become even more likely to interfere. Bummer. A more complex potential solution might have the anchor points moving around so as not to interfere with the player.

Another idea for implementing a haptic sword is to use an array of gyroscopes mounted to a sword handle. The gyroscopes would be double gimbal mounted to the handle so that the handle would be able to pivot in any direction freely while the angular momentum vectors of the gyroscopes remain pointed in the same direction. In order to simulate a sword hit, both axes of each of the gimbals would be locked, thus coupling the angular momentum of the gyros to the handle. The momentum of the gyros combined with the swing of the sword would cause a reaction torque, stopping the rotation of the sword abruptly. Three gyroscopes, each mounted orthogonally to the others, would be required to ensure a reaction torque regardless of the angle of the sword or direction of swing.

Such a sword could have interesting applications, like in fencing game where blades easily deflect, and touch for only a tiny fraction of a second. However, in this unactuated implementation, the wielder of the sword would still be able to translate the sword handle without resistance. In other words, after the gyroscopes lock and stop the rotation of the sword stroke, the wielder could still push (translate) their sword right through their imaginary opponent’s sword. It wouldn’t be a very realistic feeling.

For a more realistic feeling, the gyroscopes would have to be actuated to apply a sustained torque to overpower the wrists and move the sword handle. This actuated implementation is slightly trickier to think about. The gyroscopes would effectively act as CMGs (control moment gyroscopes). Changing the direction of a gyroscope’s angular momentum by rotating it with an actuating motor causes a reaction torque about an orthogonal direction. Reaction torque equals the gyro’s angular momentum cross the angular velocity at which the gyroscope is rotated.

𝛕 = L x Ω

The entire gyroscope array would still be mounted inside one double axis gimbal. To simulate a sword impact, the gimbal axes would be locked, and then, to apply further reaction, the actuating motors would rotate a combination of the gyroscopes in the array to create the appropriate reaction torque in the handle.

Gyroscopes are magical things, but they have limitations. For one, as a CMG is torqued by its actuating motor, its angular momentum vector changes, which in turn changes the direction of the reaction torque vector. In order to maintain an output torque about an invariant axis (so that the sword hit seems like it is coming from one constant direction), two gyroscopes can be paired together in a complementary arrangement called a scissored pair. The scissored pair cancels angular momentum in the unwanted direction and results in a sinusoidal torque output in one direction. This means that in addition to varying the input angular velocity to adjust the strength of the simulated sword hit, the torquer motors must also vary their speed to maintain constant output torque. To ensure a reaction torque could be applied regardless of the angle of the sword, three orthogonal scissored pairs would be required, for a total of six gyroscopes mounted inside the gimbal to the handle. (It might be possible to generate reaction torques in all directions without scissored pairs, that is, with just three orthogonal gyros, but the scissored pair arrangement is easier to think about, simpler to control, and possibly more efficient.)

The other limitation of gyroscopes arises from the law of conservation of (angular) momentum. A gyroscope cannot be made to apply a torque about the axis along which its angular momentum is aligned. As a CMG is torqued, it gradually aligns with the direction of output torque as it transfers angular momentum to the system. When it becomes aligned, it has reached what is called saturation - it can’t transfer any more momentum in that direction. What this means for the sword is that the gyroscopes can’t sustain a simulated hit infinitely. Flight simulators have this same problem - they can’t simulate an infinite acceleration. Besides increasing the stored angular momentum, the way to get around this is to reset the angular momentum direction slowly, under a sensory threshold.

So what does this gimballed triple scissored pair system look like? It is big and heavy. If we want the sword handle to be able to apply 30N*m for a period of 1s, it would weigh around 7kg (a gallon of milk weighs 4kg) and take up a space of about 0.3m in diameter, probably very optimistically. Not exactly something that would be feasible to swing around. These numbers are based on my rough calculations assuming carbon fiber rotors spinning at about 30,000rpm, geared brushless DC torquer motors, slip rings for the gimbals, and very nice expensive design. It would be a fun optimization problem though.

What if we reduce the torque spec by about a fifth, to 6N*m? The rotors and torquer motors and gear train get somewhat smaller in size, so the diameter of the system could be reduced by about half. But the complexity of the system is still the same, so the system mass is would only be reduced by about half as well. Switching to a system with three individual gyroscopes (instead of scissored pairs) also doesn’t help much for system size and mass because the rotors have to get bigger.

So it’s not an obviously economically or practically feasible design for a consumer VR system, but it could certainly be prototyped with some money and effort.

While investigating this idea, I evaluated many other combinations of gyroscopes and gimbals to achieve the desired effects, but all ultimately had problems complexity. Reaction wheels can’t generate a high enough torque for an extended period, single gimballed scissored pairs aren’t able to decouple their momentum from the handle, and while an array of single gimballed gyroscopes potentially can, that arrangement is more complicated than a single encircling double gimbal. Gyroscopes are fun to think about!

So this idea of realistic sword haptics gets tossed for now.

hmmm, what about reaction jets???

Monday, December 19, 2016


A family member was under the misguided impression that gerrymandering was not much an issue these days. I collected some images to show just how alive gerrymandering is today.

Explained graphically:

The tactics are called cracking and packing.

North Carolina congressional districts in real life:
Outcome:  10 republican (77%), 3 (33%) democratic congresspeople. Vote count: 53%R, 47%D. Another way of calculating this difference is with a concept called the efficiency gap.

It's also easy to see in the results how the packed 1st, 4th, and 12th districts are consistently won by democrats by much higher margins (~35%) than the republican districts (~17%).

Close up of Charlotte:
Look at that and try to say racial gerrymandering doesn't happen in the US these days.

Observe what happens in district shapes around 1995.

This happens all over the USA:

NC 4th district:
Texas 35th district:

Thursday, December 8, 2016

renewable energy advocates are not misguided

A friend was under the impression that the DAPL protesters and others fighting fossil fuels are misguided in their efforts. He believed that people are being misled about renewable energy sources like solar and wind, and that the full nuclear option is the only rational choice for stopping global warming.

I hoped to broaden his perspective.

First, as an example case, I imagined what the reservation would look like powered by only solar:

"The electricity demands of the people on Standing Rock Reservation could be easily met with 2km^2 of solar power. That is about 1/5000 of the land area of the reservation.

Let’s do the math:

The average electricity consumption per capita in the USA in 2013 was about 1800W. That is way high for a rural reservation without industry, but we’ll use it. The population of the reservation is about 8000. So we have 15MW. Solar panels can roughly provide about 10W/m^2 of continuous power, accounting for solar intensity variations, nighttime, and efficiency. In order to get 15MW, we therefore need 1.5km^2 of solar. The area of the reservation is about 10,000km^2. So the solar plant would take up about 1/5000th of the land area of the reservation.

The population density of the entire Dakotas is about 4x higher, but we haven’t considered wind (which has a similar power density to solar), and it’s really fuckin windy in the Dakotas.

What about their gas guzzling cars? Liquid fuel is an issue, but if they all drove electric the reservation’s electricity consumption would increase by about 50% (transportation energy consumption is similar in size to residential consumption, but EVs are way more efficient)."

Oil production is not really related to electricity production so we kinda had two conversations going.

"Among the many reasons for fighting these oil pipelines, the most important is to force the costs of oil production as high as possible in order to encourage transition over to sources of energy that do not release CO2. They are fighting the right battle.

I do agree that, in addition to renewables, we should be seriously ramping up the construction of nuclear plants, not tearing them down. Their relative environmental impact is indeed minimal.

Excellent technical discussion about sustainable energy, and my main reference."

He was a little confused on units, so I elaborated.

"Thanks for recommending to look at the NREL maps to check my quick estimate. However, it seems I come to an even better conclusion! I am looking at this map:

Perhaps you are confusing the units of kWh/m^2/day with W/m^2? I also read off a value of about 5 for annual averaged solar resource at standing rock, but it is in units of kWh/m^2/day, not W/m^2. The two units are both units of power/area, but they have different quantities (like the difference between an erg and a joule). If you do the conversion (I like to do it by hand, and then check it with something like WolframAlpha), it turns out that 5kWh/m^2/day equals about 200W/m^2. (I prefer converting to W/m^2 because it lets me compare to consumption easily.) You can also double check this by looking at a weather station which often records insolation. For example

Squish down that yellow hump over 24 hours and you get about 100W/m^2, cuz it’s winter.

Then, we do our PV efficiency cut of 15%, which leaves us with 30W/m^2. Looks like I was being pretty conservative before with my estimate of 10W/m^2.

The fine print for that map says that it already takes into account all the qualifications you raise:
- it assumes fixed, flat plate collectors,
- it takes into account the number of sunny days and the seasons,
- it takes into account sun angle, and
- it even takes into account nighttime because it is using units of energy produced per day (24 hours). Thank you, NREL for making this easy!

Now we’re down at 0.5km^2 of solar for all of standing rock!

A quick glance at another NREL study suggests this all is totally reasonable. Already, ND could generate about 25% of its household electricity by installing PV on the roofs of all its small buildings.

Now, the problem of intermittency. I did not explicitly state in my last comment that I was assuming energy storage coupled to the solar PV. I am. This is pretty standard, and becoming more so (think molten salt storage, Tesla Powerwalls, and electric vehicles). For example, the Crescent Dunes Solar Thermal Plant, which generates about 0.1GW, has about 1GWh of storage. That means that even when it is pitch dark, assuming the battery is charged, it can put out 0.1GW for 10 hours. Plenty to cover daily swings in consumption.

What about winter/summer swings? Our friends at NREL suggest seasonal resource ranges from 3 to 7 kWh/m^2/day. That’s a factor of 2, and usage maybe doubles, so that puts our estimate for the reservation back at 2km^2."

Here's what 2km^2 looks like in the context of the reservation (the red rectangle):

Finally, my friend was misinterpreting an out of context quote from David MacKay, british physicist turned sustainable energy expert. He thought that MacKay was unequivocally stating that we should ditch all solar and wind effort in favor of nuclear. My response:

"I believe you are misunderstanding MacKay’s intention in that excellent video. He is answering a question about what he thinks is the ideal optimum scenario for a carbon neutral UK. He says all nuclear. I think you, MacKay, and I are all in agreement on the promise of nuclear as a steady, clean power source that could be scaled up to meet all our electricity needs. However, the world does not work in optimum solutions. It works by patch jobs. It works through diversity and compromise. Fighting exclusively for the optimum solution has always been the downfall of well meaning engineers everywhere. Especially in the current cultural climate where nuclear is unjustly frowned upon and in the current economic climate where the LCOEs for renewables are just about the same for fossil fuel or nuclear, solar and wind are strong palatable options for making progress against climate change. There is no excuse for holding out for an optimum solution when progress can be made immediately.

Secondly, while his point is correct that when you already have enough nukes to last through the winter, building more solar or wind is a waste, we are nowhere near that point yet. At this point, during the transition, the existing fossil fuel plants will act as the backups.

Thirdly, MacKay repeatedly states that his energy portfolio recommendation would be different for other countries. The UK is significantly worse off compared to the USA in terms of solar and wind resources.

My point through all this (besides destroying your absurd original claim that “their reservation would literally be one giant solar panel” :) ) is to emphasize just how important a role solar (and wind) will play (and are already playing) in transitioning away from fossil fuel electricity. Obviously the Dakotas will not be the first place we start to see proliferation of solar PV (but installed wind in ND is 10th nationally), but sometime soon, it will be economical, particularly if we keep fearing nukes. Do you think the >50% of Americans who oppose nuclear will be able to be convinced to install 100s of nuclear plants instead of solar or wind in the next 10-20 years? I wish. Perhaps we can override their protests and force them (hi, mr trump!)? Perhaps with an insane public education effort. But those don’t usually work :/

Tuesday, December 6, 2016

don't ignore empathy

screw this empathy thing. just focus on turnout and crush them next time.

Shorter version:

I’ve recently been feeling this futility of ever opening their minds when trying to communicate with my right-wing media saturated relatives, so I was initially attracted to this thesis. But I think it is a mistake to ignore the lessons that cognitive empathy can teach us here.

For example, wealth concentration in big cities is leaving people behind. In order to rebuild the democratic party and earn votes from this new minority, we must understand what is important to them, and from that, learn how best to present a case to them for easing the transition to a new way of living.

I do agree that the tools of the right wing media are formidable. But liberals should recognize that wielding those tools requires understanding and exploiting how people think. Propaganda is a twisted form of empathy. Liberals seeking to capture new voters should appreciate this in order to combat it.

I thought the nytimes article on “equal voting rights” was misleading. If we are OK with progressive income tax, we should also be OK with a progressive tax on rich states. If we are OK with the disproportionate representation in the Senate, we should also be OK with disproportionate representation in the electoral college. It was designed in for a reason.

Perhaps increased turnout in 4 years will be sufficient, as the pendulum of public opinion swings our way. Perhaps this is a fluke minority that can be simply ignored and crushed. I just hope that this valuable opportunity for questioning and for learning other perspectives, which has been provided by the shock of the election, will not be ignored.

Longer version:

I have recently been feeling despair and the futility of ever opening their minds when trying to communicate with my right-wing media saturated relatives. Certainly, millions of people learning to build empathetic relationships with the other side is not going to happen. It’s frankly just a difficult thing to learn to do and succeed at. But I think that “if only we had empathized with them more" is nevertheless of fundamental concern and is the key lesson that the democratic party has forgotten.

For example, wealth has been concentrated in a few rich cities and big corporations as never before. Globalization and monopoly are leaving people in developed countries behind. Tempering inequality is necessary to stabilize a democracy. The redistributive tools that have been used successfully in the past are no longer working to keep people content. In order to earn this new minority’s votes, we must understand what is important to them, and from that, learn how best to present a case to them for easing the transition to a new way of living. That is cognitive empathy. Rebuilding the democratic party will involve both constituents and leaders remembering that empathy is critical to preventing these kinds of calamities.

I do agree that the tools of the right wing media are formidable. But liberals should recognize that wielding those tools requires understanding and exploiting how people think. Propaganda is a twisted form of empathy. Liberals seeking to capture new voters should appreciate this in order to combat it.

Regarding “equal voting rights”, the nytimes article you linked seems to be implying that we should be fighting for either fixing the electoral college by eliminating the electoral votes allotted to a state for its senators, or eliminating it altogether. Both of these seem like poor ideas to me. For one, the electoral college result would not have been different if those votes had been eliminated. And frankly, I see nothing wrong with a progressive tax on rich states, or for that matter, greater representation for less populated states. As obvious as it is to us that the future has us concentrating efficiently in cities, we cannot ignore the people who are slow in transitioning. Second, eliminating the electoral college is the cry of a sore loser. As far as I understand the history, it was not “plotted” but designed in for the very specific reason of checking a tyranny of the majority which, in this case, is us. (It was also designed to keep incompetents from holding the office, which it is indeed failing to do).

Perhaps we can just work for increased turnout in 4 years, as the pendulum of public opinion swings our way. Perhaps we don’t need to empathize with and appeal to a broader base. Perhaps this is a fluke minority that can be simply ignored and crushed. I just hope that this valuable opportunity for questioning and learning, which has been provided by the shock of the election, will not be ignored.

Saturday, November 12, 2016


While part of me is uninterested in conversing about how Trump won (instead preferring to focus on why and what to do next), I was intrigued enough to examine the different narratives I was hearing.

One narrative, for example that arrived at by usually more liberal publications, suggests that Trump won by by motivating minimally educated white voters in large numbers.

Another narrative, less mentioned by liberal publications, suggests that Clinton lost because of low turnout from usual Democratic bases.

I took at look at some of the turnout data compiled by David Wasserman at 538. My spreadsheet here. I wanted to compare the change in turnout specifically in the 6 states that Trump flipped from 2012, in order to see the impact on the electoral college.

In Wisconsin (10), Ohio (18), Michigan (16), Iowa (6), the Democrat drop in turnout from 2012 to 2016 had a bigger effect than the increase in Republican turnout. In Pennsylvania (20), and Florida (29), the Republican increase in turnout had a bigger effect than the drop (or weaker increase for FL) in Democrat turnout.


There are obviously all sorts of details that this kind of broad analysis ignores, but generally speaking I think we can say that poor support for Clinton (whether due to apathy, sexism, disgust) had as much of an impact on the outcome of this election as rising support for Trump.

Monday, November 7, 2016

What is Paragliding?

A quick intro to paragliding presentation I gave:

It's not as dangerous as it might seem. And you get to fly! With only 20lbs of equipment!